Get in Touch

CONTACT US

iPhone Application Development – View Controllers (Autorotation)

Autorotation

When the device is rotated, the top-level view controller should also have its bounds reoriented to the device orientation.

iPhone Application Development – View Controllers (Autorotation)

The following steps could accomplish this.

The view controller should return YES to the should autorotate method.

-(BOOL) shouldAutorotate
{
return YES;
}

The supported orientations should be defined in the view controller

-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}

The application should also allow rotation to the orientations that can be specified in the info.plist file

Whenever the rotation will or did happen the following notifications are triggered

-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)
toInterfaceOrientation duration:(NSTimeInterval)duration;

-(void)didRotateFromInterfaceOrientation:
(UIInterfaceOrientation)fromInterfaceOrientation;

We are able to specify the format from the subviews in this particular method. This particular could also be completed as a result of Autolayout technique, which may aid us in specifying the format from the subviews with the help of format limitations.

DidReceiveMemoryWarning

In the event the application runs from recollection, your see controller are going to be recommended by making use of using this method which approach are going to be induced.If you use too many photographs or even mass media data with your application and if these types of the file have been in recollection this can happen. In the event that these kinds of data usually are not being utilized and if they may be recreated we ought to arrange your pointer to these kinds of data as zero.

– (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

Share