Orientation is a pretty feature of iphone and ipad using gravity indicator.

– (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration {

UIInterfaceOrientation toInterfaceOrientation = self.interfaceOrientation;
[UIView beginAnimations:@”move Image” context:nil];

if(toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{

//write your code here for portrait orientation view

}
else if(toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)

{

//write your code here for landscape orientation view

}
[self viewWillAppear:YES];

[UIView commitAnimations];
}

// Override to allow orientations other than the default portrait orientation.
– (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return YES;
}

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.