I managed to show a Popover on iPad with iOS 11 and set the necessary popover properties in ViewDidLoad of my Controller. The only problem I'm facing is when I use an iPad with iOS 10. The popover presenation controller is Null on iOS 10 in ViewDidLoad.
How and where can I set my properties? If I don't set anything the Popover will eventually be shown but on the top left side of the screen since no properties were set.
And did anything change between iOS 10 and 11 that might change the behavior of how the Popover is created?
Related
I've been developing an app for the past few months, and I was always testing on my iOS 11 device and simulators. Since we are close to public release, I decided to test the app on iOS 9 and 10 simulators to make sure everything is ok.
To my disapointment, the core element of the app is broken: Its an app that displays a list of articles in tableviews, using a TabBarController. More article categories can be accessed through the side menu. However, when I display a VC form the side menu, for which I create the VC, embed it in a NavigationController and then add it in the TabBarController and make it the selected tab, the NavBar is under the status bar and the tableview's content insets extend under the tabBar, which also breaks my TabBar and creates a whole lot of other problems.
The weird thing is that after navigating to the next VC, the whole statusbar situation is fixed, so I'm guessing something is initially off with the NavBar that gets fixed once a second VC is pushed.
Does anyone have any idea on how to fix this bug? On iOS 11 everything works perfectly, while on iOS 9 and 10 only when a new VC is pushed, the error is fixed. Please note that I'm not using a UITableViewController but a ViewCOntroller with an embeded TableView, since I also need to add othr views at the bottom of my view controller.
After updating from Xcode 8 to Xcode 9 I've noticed this very strange behaviour in the navigation bar only on devices running iOS 11.
This bug appears after navigating from my left side menu that show the menu controller you choose modally with a default presentation (That is Full Screen)
I've posted a video here: https://youtu.be/mgjlbkMi-N8
It seems a bug of the compilation on Xcode 9.
Tryed also on real device iPad Pro with iOS 11.
The same code compiled with Xcode 8.3.3 works as expected, while compiled with Xcode 9 exposes the issue.
I've put a playground code here: https://github.com/shadowsheep1/xcode9navigationissue
With already a workaround: set the presentation to Over Full Screen.
But that has no meaning this is not the exptected operation.
Once the navigation bar is broken, is broken for every navigation controller in the App.
Any idea?
EDIT:
Apple Developer Relations January 23 2018, 11:13 PM
There are no plans
to address this based on the following:
You are creating a detached presentation, which is causing multiple
navigation bars to be placed in the view hierarchy. The navigation bar
that is seen is not the one where pushes are happening, thus the error
in display. I don’t know why this didn’t happen on iOS 10, but it was
an invalid configuration there as well.
We would recommend that you use a proper view controller container to
implement this menu, rather than what seems to be done (the
IS_SlideMenu_View being placed directly in the window).
I have the same problem with regular UIModalTransitionStyleCoverVertical.
I've solved it by setting UIModalPresentationOverFullScreen or UIModalPresentationOverCurrentContext.
Possibly it also helps you.
Example for navigation that is presented modally:
if (#available(iOS 11.0, *)) {
navController.modalPresentationStyle = UIModalPresentationOverFullScreen;
}
I am trying to use the UISplitViewController for iPhone portrait mode (since it will use navigation controller instead).
I tried to set the UISplitViewController's preferredDisplayMode = .primaryOverlay (which let user to swipe in/out master view from the left). However, this setting only works for iPad and Plus. iPhone still keep using navigation controller, ignoring my setting.
My question is - how to use UISplitViewController for iPhone? I see that Outlook iOS app can do this so it should be possible.
Thanks.
The UISplitViewController only works on iPads. On iPhone it acts like a master/detail view controller. If you want that UI style for iPhone you'll have to implement it yourself.
I have very strange problem on ios simulator 7.1 with auto layout but on ios 8 everything works fine.
On ios simulator 7.1 when new "View Controller" was presented through segue its content becomes layout incorrectly and sometimes even moves.
Demo code on github:
https://github.com/Misterio26/iOS-7-Simulator-Bug-demo
This demo uses only interface builder, there's no hand code at all, that is why I very surprised about this bug.
To reproduce:
use xCode 6
run with ios simulator (7.1)
press "Works", you will see a test screen that is aligned correctly (sometimes not), then press "Back"
press "Bug", after screen appearance you will notice some ui movement and incorrect alignment (sometimes it shows constraints error in console log)
I log window.hasAmbiguousLayout in viewDidAppear, and it print "false" for iOS 8 and "true" for iOS 7. Looks like iOS7 creates wrong constraints for presenting view controller. I used "po [[UIWindow keyWindow] _autolayoutTrace];" and it confirmed my suggestion.
I can't belive that only I have noticed this problem.
Can someone help me to know:
Is it simulator bug or it happens on real device too? (I don't have ios 7 device, just 8, and apple doesn't allow to downgrade ios)
Or maybe it can be fixed?
Or you can only try to reproduce that window.hasAmbiguousLayout becomes "true" after segue (I think that it's very dangerous bug):
create new iOS project in XCode6
in IB create new View Controller with one button
in IB create second View Controller with any content
in IB create "show" segue from button to second view controller (command + drag from button to second view controller)
in CODE create new class #interface CustomViewController : UIViewController
in CODE add to CustomViewController
- (void)viewDidAppear:(BOOL)animated {
UIWindow* window = [UIApplication sharedApplication].keyWindow;
NSLog(#"viewDidAppear hasAmbiguousLayout %#", ([window hasAmbiguousLayout] ? #"true" : #"false"));
}
in IB apply class CustomViewController to second view controller
run on ios 8 and you will see "viewDidAppear hasAmbiguousLayout false"
run on ios simulator 7.1 and you'll see "viewDidAppear hasAmbiguousLayout true"
I think it's very dangerous behavior.
I Have Developed an Application. In that one i Added a GMSMapView and also Two Buttons at the Bottom. If i run this Application on iOS Simulator Version 7.0 all the outlets on the XiB are Visible. But If i run this Application on iOS Simulator Version 6.1 one of the Button is not Visible. Can any one please tell what is the Reason why it is hiding one button if the Height of the Device is Same.
You can use delta value that will effect the layout for the ios 6 not to the ios7
if you are set view as ios 7 in interface buinder you need to decrease you y position show image below
-64 delta y because you use navigationbar at top so it's size 44 and +20 for status bar