iOS 13 Presenting Modal half screen for iOS, popover for iPadOS - popover

What I'm looking to achieve is the exact same behavior as share view of iOS 13. I want to present my custom picker view as popover on iPad, and as semi modal on iPhone. I'm currently using "present as popover" on storyboard, which I get the default behavior that auto switches between popover and modal for free. I guess I need to switch to custom controller, but I'm lost on how to achieve this.

Related

Xamarin Forms - Camera and Image Picker doesnt work when using Modal Popup

I have a Xamarin forms app, that loads a camera and image selector, when I use it in a page they both work fine, however when I am in a page and then use a modal popup to display the same page the links to the camera / image selector does nothing.
I get this error in the Output window in Visual Studio
Warning: Attempt to present <UIImagePickerController: 0x1276b2400> on
<Xamarin_Forms_Platform_iOS_PlatformRenderer: 0x128678400> whose view is
not in the window hierarchy!
I am updated to 4.2.0.719 Xamarin and Xamarin.iOS 10.2.0.4
Anyone have any ideas to get around this in Xamarin Forms ?
I notice a post regarding iOS iOS 8 SDK: modal UIWebView and camera/image picker but this is not for Zamarin ?
I recall having come across a similar issue before and filed a bug report: https://bugzilla.xamarin.com/show_bug.cgi?id=44500
Bug 44500 - A WebView that has a file picker control fails to show photo picker when page is pushed modally.
Description
A ContentPage with WebView that has a file picker control fails to show photo picker when ContentPage is pushed modally. This warning is displayed when the WebView tries to open the UIImagePickerController:
Warning: Attempt to present <UIImagePickerController: 0x7ba68800> on <Xamarin_Forms_Platform_iOS_ModalWrapper: 0x7e379c90> whose view is not in the window hierarchy!
Works as expected when page with WebView is pushed non-modally.

How to incorporate a UISearchController into new (iOS8) UISplitviewController

I try to build a simple app based on the UISplitViewController template from Xcode 6 for universal apps (with Storyboard and CoreData/NSFetchedResultsController). This app should also provide a search bar for the MasterViewController. Unfortunately, Xcode 6 provides no InterfaceBuilder element for the UISearchBar/UISearchController combo (only the depreciated UISearchBar/UISearchDisplayController).
In the iOS Developer library, Apple provides the "Table Search with UISearchController" example, but this is not based on the UISplitViewController and supports only iPhone.
My problem is, that I'm not able to show the detail view on the correct ViewController under all circumstances. I tried to transfer the approach from the Apple example project to the UISplitViewController template. In this, one is encouraged to show the search results in a separate UITableViewController subclass (ResultsTableViewController) and use this as the searchResultsController of the UISearchController. I was not able to create a scene in InterfaceBuilder for this setup so I had to add these manually in code.
The problems begin when I click on a table cell of the ResultsTableViewController. This vc is not part of the scene in InterfaceBuilde and I don't know how to add it to the SplitViewController setting correctly. The biggest problem is the weird behavoir of the iPhone 6 Plus and the UISplitViewController. In portrait mode it behaves like an iPhone and doesn't seem to have a SplitViewController and only uses a NavigationController to which I push my DetailViewController. In landscape mode it behaves like an iPad with SplitViewController were I have to get the second ViewController of the SplitViewController childControllers and push the DetailViewController on this one.
Now it happens, when I start in portrait mode and switch to landscape mode that the DetailViewController is all gone, showing gray space where the DetailVC should be. It seems, when going to portrait mode, the DetailViewController gets kicked from the SplitViewController (or the SplitViewController gets kicked at all in favor for the iPhones NavigationController setup). When switching back to landscape the SplitViewController is initialized again but without proper initialization of the DetailViewController.
Is there any template or suggestion on how to correctly implement search capabilities on a universal UISplitViewController?
Cheers
Björn

Use present as popover in a universal storyboard

Apple recommends to use a single storyboard for universal apps through size classes.
Now I am trying to adapt the UI depending on the device, which has worked quiet well so far. The only problem I'm facing is how to assign the specific segues.
For instance the settings, which in my App consist of only two tableview cells, should be made visible via a "present as a popover" on the iPad and a regular "show (e.g. Push)" segue on the iPhone.
Is there any way to define it just like that using storyboards or do I need to write supporting code?
Nick
In WWDC session Apple engineer used "Present as popover" segue.
This one shows view modally on iPhone and popover on iPad. Though, you'll have to write some code to show Back button on iPhone.
If you need to have popover and push segues, I'd do that in code this way:
Make 2 segues 'Present as popover' and 'Show'
Set up segue identifiers
In code identify whether app running on iPhone or iPad
Launch correct segue

image position iOS 7 vs iOS 6

I have a background image issue for my app after I updated the project for iOS 7.
The app is navigation controller managed. I have a background image (UIImageView) created in IB. Since I place it a bit under the navigation menu I assume that the placement is calculated from the top of the view which in iOS 7 is beneath the Navigation Controller. When I run the app in iOS 6 the image is quite far down on the screen. Once again I assume this is because the top of the view in iOS 6 is below the Navigation Controller menu.
How do I fix so that the image has the same vertical distance from the navigation controller in iOS7 and iOS6?
Best regards
Frederik
iOS 7 brings several changes to how you lay out and customize the appearance of your UI. The changes in view-controller layout, tint color, and font affect all the UIKit objects in your app. In addition, enhancements to gesture recognizer APIs give you finer grained control over gesture interactions.
Please refer answer here.
One solution what I did is : I hooked background image to a reference from my xib, and set the frame programmatically from ViewDidLoad. It works fine.Please note that not forget to check iPhone 5 and iPhone 4 and set height to 568 and 480 respectively.

ipad storyboard in xcode cannot drag button

I'm running xcode 4.5.2 to write an iOS app for both iphone & ipad ("universal" app).
I'm able to use the iphone storyboard to drag & drop buttons, labels, etc onto it. In fact I have functioning code on the iphone side.
However, since the beginning, I have not been able to drag & drop anything onto the ipad storyboard. When I try to do so the buttons, labels, etc just "bounce off".
Is there a way to reset the iPad storyboard so that I can get a clean start? It potentially could be that I had mistakenly (this is my very first iOS app) dragged a view or view controller onto the ipad story board. I tried deleting it but the whole ipad storyboard disappears after that.
It is probably something very simple but I'm very new to this. Thanks.
You can only drag & drop items into a view if you are in the most "zoomed-in" way of viewing it. Try pressing the "=" in the bottom right corner when you bring up your iPad storyboard (this will toggle between the most zoomed-in and the most previous zoom out). Once it zooms you in all the way, try dropping something onto your view again.
EDIT: Per Xcode 8 Release Notes, Interface Builder should now allow editing at all zoom levels.

Resources