NTNT
NTNT

Reputation: 541

The Rotation in iOS 8

I have just upgraded to Xcode 6 and when running my app in iphone 6(ios8) the screen sometimes cannot rotate. This issue is not happen in ios 7. I searched in the internet and see willRotateToInterfaceOrientation is deprecated in ios 8. Current my code is implementing this function, if i replace it with new funcion viewWillTransitionToSize, the app runs on ios7 will not be affect ?

I can call the willRotateToInterfaceOrientation as below

[self willRotateToInterfaceOrientation:interfaceOrientation duration:0.0];

But i don't know how to call viewWillTransitionToSize

[self viewWillTransitionToSize:<#(CGSize)#> withTransitionCoordinator:<#(id<UIViewControllerTransitionCoordinator>)#>]

What should I send CGSize and UIViewControllerTransitionCoordinator in this function? Please help me. Thanks in advance.

Upvotes: 1

Views: 2251

Answers (1)

Prabhu.Somasundaram
Prabhu.Somasundaram

Reputation: 1390

Hope you have set the below items in project->general tab. enter image description here

AND you just give this

-(BOOL)shouldAutorotate {
   return YES;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
   return YES;
}

- (NSUInteger)supportedInterfaceOrientations {
   return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortrait |UIInterfaceOrientationMaskPortraitUpsideDown;
    //or simply UIInterfaceOrientationMaskAll;
}

Happy Coding :)

Upvotes: 2

Related Questions