Note that there are some explanatory texts on larger screens.

plurals
  1. POPrevent rotation of ABPersonViewController and ABNewPersonViewController on iOS6
    primarykey
    data
    text
    <p><strong>In direct reference to this question:</strong></p> <p><a href="https://stackoverflow.com/questions/2797515/how-to-stop-rotation-of-abpersonviewcontroller-abnewpersonviewcontroller-in-la">How to stop rotation of ABPersonViewController &amp; ABNewPersonViewController in Landscape mode in iphone</a></p> <p>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.</p> <p><strong>Screenshot:</strong></p> <p><img src="https://i.stack.imgur.com/jtPDi.png" alt="enter image description here"></p> <p>The above image is taken from a subclass of the <code>ABUnknownPersonViewController</code>, in this subclass the only functionality I have implemented is to override the rotation methods as follows:</p> <pre><code>- (BOOL)shouldAutorotate { return NO; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { if(toInterfaceOrientation == UIInterfaceOrientationPortrait) return YES; return NO; } </code></pre> <p>However, the issue is, I cannot then subclass the <code>ABNewPersonViewController</code> 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?</p> <p><strong>UPDATE 1:</strong></p> <p>I attempted to create a category on the <code>ABNewPersonViewController</code> and <code>ABUnknownPersonViewController</code> 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?</p> <p><strong>UPDATE 2:</strong></p> <p>Is it possible to gain a reference to the buttons in that <code>UITableView</code> 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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload