Handling device orientation for iOS 8 Portrait/Upside down - ios8

My current code for Portrait/Upside down orientation only works for iOS 7 devices iPhone/iPad. However, for iOS 8 devices it doesn't work. The code I use is ...
-(NSUInteger)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}
I'm working in Xcode 6.1, not using size classes and auto layout. Regular storyboard, no navigation controller.
I'm researching this and can't seem to find anything that works.
Is there a different way to do Portrait/Upside down orientation change for iOS 8 right now?

Related

Device missing from View As: in Storyboard

I'm following a tutorial which indicates I should select iPhone 8 from the View As panel to change the size of the view controller in Storyboard.
iPhone 8 is not appearing. However it does appear in the list of devices that I can actually run in the Simulator. I'm running Xcode 11.5. Any thoughts?
I'm speculating here, but since Apple discontinued the 8/8+ and the second generation iPhone SE has the same screen size as the 8 (4.7 inches), they most likely dropped it from Xcode. The 8 Plus still has a unique screen size in the iPhone line-up. You can use the SE gen 2 in place of the 8 for storyboard layout.

supporting view on different IOS devices.

My app is supposed to run only on Iphone but apple is testing it on Ipad too. Apparently, the apps can run in Iphone mode on Ipads. How do I know which Ipad will run which Iphone mode (ex: ipad mini air2 = iphone 5 view settings in iphone mode?)?
How can I change the size of my UI based on changing aspect ratio programmatically ? (My views are created through code).
The iPad Pro runs an iPhone 6. The iPad 2 and Air 2 run an iPhone 4s.
I don't know if there's official documentation for this, but what I did is create a sample app and set the Devices to iPhone only. Then I added
print(self.view.frame.size) //Swift
NSLog(#"width = %f, height = %f", self.view.frame.size.width,
self.view.frame.size.height); //Obj-C
in the default ViewController. This will print the screen size of the view only, and not the entire iPad's screen. I then compared the printed value to the printed value of the same app run in iPhone 6/4s. You can try it too.
In terms of changing the size of your UI to fit different screen sizes, your best bet is probably AutoLayout. There are many (free, open source) frameworks available that make creating AutoLayout constraints programatically much simpler.
A few are Stevia, Cartography, SnapKit (Swift) / Masonry (Obj-C), or PureLayout.
As you said your app is supposed to run on iPhone only, then do the following process.
Select your project target in Xcode and goto General in which there is one section Deployment Info
Change the Devices to iPhone from dropdown
this will open app on iPhone only.

Xcode 6 beta iPad simulator portrait no split view on launch

In iPad i am using split view controller (one of my existing apps). Using Xcode 6 beta: If I launch the iPad simulator(s) with the device in portrait orientation it only shows the detail view and not the master view as well (and no "master" back button). If I rotate then to landscape all appears fine, rotate back to portrait and the "master"back button appears and can then access the master table view. With previous versions of Xcode the split view launches in portrait view.
I also noticed this, it seems to be a bug in Xcode 6 and iOS Simulator 8. You can send a bug report to Apple here
I had the same issue when running my app on the iOS8 simulator using xCode6-beta2. However, when I ran the app on my iOS7 device, the master view title showed up correctly. Sounds like an iOS8 issue.

Autolayout adjusts perfect in iOS 7 but not in iOS 6

I have a view in my app that is in landscape and I have set upp the UI in my storyboard so it responds as I want to different screen sizes. Now this works exactly as I want in iOS 7 but when I ran it the app in iOS 6 it is like it's not responding to my storyboard settings:
My app is mainly in portrait so this view in the app is set in landscape by subclassing the navigation controller:
// CustomNavigationLandscapeViewController.m
- (BOOL)shouldAutorotate
{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotateToInterfaceOrientation(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
So is there something that I'm doing wrong to get this behavior? Why does it work perfectly in iOS 7 but not in iOS 6?
After restarting Xcode and doing a clean the problem was solved. Guess it just was a glitch in Xcode that came in an inappropriate time.

Custom input view does not work anymore in the iPhone iOS 6 simulator

I have made an app, which has a custom input view, it works fine on the ios 4.3.3 and ios 5.1.1 as well as the new ios 6 if compiled using xcode 4.3 with the base SDK 4 but after updating xcode to the latest version and compiling using the ios 6 sdk the input view does not work anymore. if input button are taped the text doesn't show in the textField. Does anyone encounter this problem or now its cause ?
Make sure that you are initializing your custom input view with a frame that has a width or height larger than zero. From what I can tell, if this isn't the case then iOS 6 doesn't even add the view to the view hierarchy.
In my case, the width of my keyboard view's frame was zero when calling initWithFrame:(CGRect). Everything worked fine in iOS 5, as the frame width would get set during layout, but in iOS 6 the keyboard wasn't even in the view hierarchy.
I used iOS Hierarchy Viewer to figure that last bit out with having to fiddle in the debugger too much.

Resources