I am using a universal storyboard and sizing to handle both the iPhone and iPad. This has been working well except when it comes to popovers. That is a screen that will be a popover on an iPad but a modal screen on the iPhone. I am finding that the only size class that will impact layout for both is wAny hAny I want to use Final Values for each so that the behavior will be as I want for each device. However, unlike regular screens this type seems to only respond to wAny hAnyfor both iPhone and iPad. Should I not be able to set each separately to accommodate the different devices?
Since iOS 8, you don't need to handle popovers separately on different size classes. They are handled automatically by a UIPresentationController.
If the modalpresentationStyle property on the UIViewController is set to UIModalPresentationStyle.Popover, UIKit will present it, using a UIPopoverPresentationController, as a popover on a regular size class (iPad) and modally on the compact class (iPhone).
If you're using storyboards you can control it on the segue and setting the segue attribute as Present As Popver:
Related
I am trying to make a custom launch screen based Xcode 6 new feature following the content given here. I don't understand how can I manage orientation of launch screen on iPad. My launch screen contains a horizontal rectangular image in the centre. Using size classes I can set different constraints and views for iPhone in landscape or portrait mode. But unable to do the same for iPad. Also how can I lock the orientation of Launch screen when creating a launch screen using the above method ?
You can not do this for the iPad because both orientations fall under the regular width and regular height size class.
I want to initially launch one of the View controllers in JUST landscape mode, while the other views and the whole app can work in both portrait and landscape. How can I do it in iOS 7? Thank you.
So your whole app may supports all orientations but one view controller needs to be landscape only.
You can easily stop your landscape view controller to rotate from landscape to portrait but when the app is in portrait already then it is difficult to force the deivce to rotate as this contradicts the iPhone manufacturers priciple.
In fact, it is not really difficult when you know the trick. See my answer to this similar question.
Force controllers to Change their orientation in Either Portrait or Landscape
I found a ColorPicker (ILColorPicker) that takes the whole screen on an iPhone. I want to use it in my iPad app (XCode4 using StoryBoards)... it's asking me to "In your view controller's XIB, add a UIView and then set it's class to ILColorPickerView ". I don't want to use the entire scene, just a small part of it... is there another way I can accomplish this? (using Layers, frames, etc)?
You could programmatically create a popover (UIPopoverViewController), and put the color picker as the view for your popover.
I appreciate I'm probably missing something basic here, but...
My iPad app will only support landscape mode, and has a MainWindow.xib Window that I'd like to work on in landscape mode in XCode 4, however the pull-down menu to change this (Simulated Metrics -> Orientation) is always grayed out.
I notice that Views can be rotated just fine, it's only Windows that can't be rotated in XCode 4 using this setting.
Is there a workaround for this, or do I have to put a View on top of the MainWindow in order to rotate it?
I think it's because apps always starts up in portrait and then rotates to appropriate oriantations. From the UIViewController docs:
Note: At launch time, applications should always set up their
interface in a portrait orientation. After the
application:didFinishLaunchingWithOptions: method returns, the
application uses the view controller rotation mechanism described
above to rotate the views to the appropriate orientation prior to
showing the window.
So you'll need the UIViewController magic for the simulated metrics to make any sense. If you used the "Window-based application" template as a starting point for your project try the "View-based application" template instead.
In my tab bar iPad application, one of my tabs needs to have an "ABPeoplePicker", ie a view exactly similar the view that ABPeoplePickerNavigationController presents. However, only the controller is exposed in the API and Apple warns against having several controllers to manage a single screen.
To expose the idea slightly differently, Apple explains how to use ABPeoplePickerNavigationController modally. That's about the only use case for the small iPhone screen, but the iPad larger screen allows for a modeless use case inside the screen.
Is this possible or do I have to redesign my picker from scratch?
I was trying to do just that and did not succeed.
A delegate can not be subviewed it seems.