In direct reference to this question:
How can I prevent this screen from rotating in iOS 6 when I am not the one pushing the view controller? Scenario being I create a new contact, and the user then presses either the 'Create new contact' or 'Add to existing contact' buttons. The screen produced is the ABNewPersonViewController but because I do not have direct access to the rotation methods, I am unable to prevent it from rotating.
Screenshot:
The above image is taken from a subclass of the ABUnknownPersonViewController
, in this subclass the only functionality I have implemented is to override the rotation methods as follows:
- (BOOL)shouldAutorotate
{
return NO;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
if(toInterfaceOrientation == UIInterfaceOrientationPortrait)
return YES;
return NO;
}
However, the issue is, I cannot then subclass the ABNewPersonViewController
screen that is pushed when one of the buttons in the above image is pressed to override the rotation on iOS 6. Any ideas on how I can legitimately get access to these buttons OR override the rotation on the screen that is pushed to prevent it from doing so?
UPDATE 1:
I attempted to create a category on the ABNewPersonViewController
and ABUnknownPersonViewController
that overrode the rotation methods (not ideal, I know) and then globally imported, but this did not work. Other than this, I am completely stuck for ideas on how to override this behaviour. Any suggestions?
UPDATE 2:
Is it possible to gain a reference to the buttons in that UITableView
and override the methods they call? Or is this in violation of Apple terms by accessing private APIs? Trying to investigate this approach so far and not really getting anywhere.