Note that there are some explanatory texts on larger screens.

plurals
  1. PORotation compatibility for iOS 5.1 and iOS 6
    primarykey
    data
    text
    <p>In a <strong>universal app</strong> that needs to run both on <strong>iOS 5.1</strong> and <strong>iOS 6.0</strong> I use the above code to allow <strong>rotation</strong> in both versions, and both on the iPhone, both on iPad. Is There a better way to do this, while maintaining compatibility between the two versions and without using deprecated functions? With the above code I have some little issues in iPad with iOS 6.0, sometimes...</p> <p>Thank you.</p> <pre><code>// Override to allow orientations other than the default portrait orientation. // Rotation for v. 5.1.1 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { // on iPad support all orientations return YES; } else { // on iPhone/iPod support all orientations except Portrait Upside Down return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); } return NO; } // Rotation 6.0 // Tell the system It should autorotate - (BOOL) shouldAutorotate { return YES; } // Tell the system which initial orientation we want to have - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationPortrait; } // Tell the system what we support -(NSUInteger)supportedInterfaceOrientations { // return UIInterfaceOrientationMaskLandscapeRight; // return UIInterfaceOrientationMaskAll; return UIInterfaceOrientationMaskAllButUpsideDown; } </code></pre> <p>Add: After some test I got again the bug also in simulator: the left part of slitViewController become black (non always) with the above errors (than it run again, rotating the iPad):</p> <hr> <pre><code>&lt;Error&gt;: CGImageCreate: invalid image size: 0 x 0. &lt;Error&gt;: CGContextSetFillColorWithColor: invalid context 0x0 &lt;Error&gt;: CGContextSetStrokeColorWithColor: invalid context 0x0 &lt;Error&gt;: CGContextGetCompositeOperation: invalid context 0x0 &lt;Error&gt;: CGContextSetCompositeOperation: invalid context 0x0 &lt;Error&gt;: CGContextFillRects: invalid context 0x0 </code></pre> <p>...</p> <hr>
    singulars
    1. This table or related slice is empty.
    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.
    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