UIModalPresentationFormSheet on iPad and iPhone
UIModalPresentationFormSheet on iPad and iPhone
- Subject: UIModalPresentationFormSheet on iPad and iPhone
- From: Andreas Falkenhahn <email@hidden>
- Date: Mon, 02 Jan 2017 17:59:58 +0100
As described in the docs, view controllers that have their modalPresentationStyle
set to UIModalPresentationFormSheet open in a popover over the presenting view
controller on iPad whereas on iPhone they often (but not always) appear full
screen.
Since I don't use Interface Builder/Storyboards to create my GUI but instead
initialize it manually viewDidLoad(), I need to find a way to deal with this
situation. On the iPad everything is nice: I set preferredContentSize to the
desired size and then do the layout in viewDidLayoutSubviews() and everything
appears nicely centered on screen.
On the iPhone, however, it looks quite ugly because the GUI now appears in the
top-left corner with lots of space to the bottom and to the right of the GUI.
In order to make this look nicer, I guess I'd have to center all my subviews
in viewDidLayoutSubviews() manually. But this is of course quite some work
so I am wondering whether there isn't an easier solution to this?
Also, how do I detect in viewDidLayoutSubviews() or viewDidLayout() whether
the view controller is being shown as a popover (as on iPad) or in fullscreen
mode (as on iPhone)?
--
Best regards,
Andreas Falkenhahn mailto:email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden