Reputation: 15
What i would like to do is to rotate at landscape mode and leave the toolbar and navigation bar at ( vertical to the right for the toolbar and vertical to the left for the navigation bar), but only rotating the view and the icons on the toolbar and navigation bar.. What i have done so far is using the willAnimateSecondHalfofRotation.When going to landscapemode the position is what i wanted but i can see the transition from rotating and it looks bad.What i am trying to do is something like the camera of the iphone when only the icons of the toolbar are being rotating...
Could you help me? Thanks in advanced. Lor
Upvotes: 1
Views: 257
Reputation: 113310
Disable auto-rotation:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Register for UIDeviceOrientationDidChange notifications:
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientationChanged:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
Respond to device orientation changes:
- (void)orientationChanged:(NSNotification *)notification {
// Adjust views according to [[UIDevice currentDevice] orientation];
}
Don't forget to unregister
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] removeObserver:self];
Upvotes: 1