Wednesday, October 3, 2012

rubyu motion autoresizingMask


view.autoresizingMask

This property is often neglected by beginner iOS programmers and is by far one of the most useful for laying out your interfaces. Consider the situation where you want your view to resize when the device is rotated between portrait and landscape orientations. The novice programmer will detect the screen rotation and will explicitly set the “frame” property of all their views to fit the new screen size. This is the WRONG way to manage your interface.
Instead you can use the “autoresizingMask” property to describe how you want your view to adapt to orientation changes. Your options (shortened for brevity) are:
  • None
  • FlexibleWidth
  • FlexibleHeight
  • FlexibleLeftMargin
  • FlexibleRightMargin
  • FlexibleTopMargin
  • FlexibleBottomMargin
eg:- in Rubymotions

    
view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin

Autorotate in Rubymotions


Add

in rake

require 'motion-cocoapods' and app.interface_orientations = [:portrait]

IN controller 

def shouldAutorotateToInterfaceOrientation(*)

    @orientation=Device.orientation


    return UIInterfaceOrientationLandscapeLeft
  end


in  @orientation you will get orientation

RUBY MOTION remove statusbar,


TO REMOVE STATUSBAR

use

 UIApplication.sharedApplication.setStatusBarHidden:Yes