1

(Using Storyboard)

I'm trying to make one of my ViewController Subclasses support more than just portrait view.

I've added in

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationPortrait));
}

but it doesn't seem to do anything. I've got all orientations except upsidedown supported in my plist, and added the shouldautorotate to allow only portrait in the viewcontrollers that I want.

markgz
  • 6,054
  • 1
  • 19
  • 41
Adama
  • 1,101
  • 8
  • 26
  • 1
    Is this under iOS 6 by any chance? If so then answers like http://stackoverflow.com/questions/13923788/ios-6-rotation-not-working are probably what you want — shouldAutorotate... is deprecated under 6 and no longer called by the OS. – Tommy Feb 07 '13 at 20:20
  • This is for ios6, yes. I tried the method of changing it to shouldAutorotate {return NO} on the pages that I want to stay portrait, but they still rotate. Not sure if this is the incorrect way of doing it but, I go to File and create a new class, as a subclass of ViewController.m/h and then I click on the view controller that I've dragged into the storyboard and change the custom class to the new subclass name in the ident. inspector. I add the shouldAutorotate into the subclass code main, and still nothing works. Is there something Im missing about connecting subclasses? – Adama Feb 07 '13 at 20:54
  • probably not, but as I said and as the answer I linked to elaborates, `shouldAutorotate...` isn't used under iOS 6. So whether your classes implement it or not makes no difference. – Tommy Feb 07 '13 at 21:13
  • possible duplicate of [shouldAutorotateToInterfaceOrientation not being called in iOS 6](http://stackoverflow.com/questions/12260261/shouldautorotatetointerfaceorientation-not-being-called-in-ios-6) – Mats Petersson Feb 08 '13 at 09:46

1 Answers1

0

The method you're looking for in ios6 is - (NSUInteger)supportedInterfaceOrientations

This essentially replaced shouldAutorotate. Use it in conjunction with shouldAutorotate.

Chris C
  • 3,221
  • 1
  • 27
  • 31