CNContactViewController and SFSafariViewController on iOS cannot be used within a UITabBarController - ios

I have been trying to use CNContactViewController without success. I want to show a list of contacts (which I expected there to be a built-in VC for), then tap into the detail of that contact and have it displayed as in the Contacts or Phone built-in app. This doesn't seem to be possible, as pushing these new VCs seems to break the UI in weird ways, see below.
My main question is: am I stuck re-creating the UI for this functionality myself, or are there known workarounds?
This example uses a UINavigationController within UITabBarController:
Initial presentation works as expected:
Tapping the "Share" button attempts to show a UIAlertController, which appears behind the tab bar, and also removes the UINavigationController's top bar:
This is similar to the issues faced in this question: CNContactViewController forUnknownContact unusable, destroys interface

Related

how to handle popUp's next viewController to embed in navigation?

I have a tab bar, an every item of it embedded in navigation controller, and several child viewControllers!
and I have a pop up view which I created in a new viewController!! to show my popUp I had to choose "present modally"!
when I go to a new viewController from my popUp on pressing button, it's not embedded in my navigation controller!
is there any way to fix it?
and the new viewControl also stays embed in navigation to show my tab bar
Unfortunately, what you are trying to achieve is not right, and please do not proceed with your initial plan.
I strongly believe a quick look at this could help you understand better UINavigationController and the difference between push vs present UIViewController in iOS.
As an answer to your question, you can imitate your wanted behaviour, but there is no direct native iOS way to accomplished your goal. Better, use pushViewController:animated: instead of present. More in the apple dev site - here.

Is UISplitViewController automatically linked to a UITableView?

I'm trying to make an iPad version of the app I am developing. The app works really well on iPhones but I'm facing problems on iPads.
Basically, in the iPad version, I add a UISplitViewController containing a UITabBarController as main controller ( left side of the screen ) whose first view controller contains a UITableViewController.
There is a UISearchBar to allow the user to filter the table view.
The problem is, on the iPad version, when I use the search bar, an other table view - with filtered content - pops up with an "arrow" pointing at the search bar.
My question is : what is this other table view that appears and how can I disable it ?
EDIT
I found this on this website
In a few situations, the framework will automatically create and
display a popover for you. One such situation is what happens when a
search bar (a UISearchBar) tied to a search display controller
(UISearchDisplayController) appears in a toolbar (UIToolbar) on the
iPad.
That's exactly what I'm talking about. How can I disable this popover ?
EDIT 2
Just found this topic : UISearchDisplayController automatically creates a UIPopovercontroller to display content search result ?! How to dismiss it?
Problem is : the provided solution doesn't fit my needs. I'd like to be able to search directly through my table view, I just don't want this popover to appear at all.
EDIT 3
Solutions founds :
I am not using UISearchDisplayController anymore.
Either UISearchController or just a selector triggered whenever changes are made on my UISearchBar's text field.

using UIReferenceLibraryViewController in custom popover controller

I am using custom popover controller(WYPopoverController) for iPhone and showing UIReferenceLibraryViewController in it. The view does come perfectly but UIReferenceLibraryViewController has 'Done' button on its navigation bar and when I click on it, it does not respond. Though if I click outside the popover then popover disappears. I simply want to disappear popover when 'Done' button is pressed.
Please note, if I use UIPopoverController for iPad, then 'Done' button in UIReferenceLibraryViewController does respond. Not sure what am I missing in custom implementation.
Any help is much appreciated.
The problem to me seems like part of a terrible design by Apple, where the reference library controller dismisses itself rather than providing a delegate method notifying you to dismiss it. First, open a bug report with Apple and post the bug report number so people can duplicate it.
In absence of better options, I would suggest replacing the controller's navigation item's bar button item with your own, where that button would notify you of the user's tap and you'd dismiss the controller properly. This is a partial solution, as the reference library controller is a complex case, where it maintains a navigation stack internally. You may have to dig in the view controller parent/child hierarchy to find all cases.
Consider changing your design in the meantime, presenting the view modally instead of a popover on phone/pod devices.

iOS complex navigation between view controllers

I have a complex flow between view controllers (vc). When my main view controller shows, it checks if a user is logged in, and if not, it pushes a log in vc in viewWillAppear. The login then can the push a register vc. Further, on app's very first start, it also shows a special vc, also from the main vc's viewWillAppear (just once). It does not matter if the user has logged in or skipped the log in.
The app can be opened also by custom URLs, which should open one of my vcs. The app must start/resume at that screen without any visble transition between vcs. All this flow is handled from my main vc, which handles this in viewWillAppear and in didBecomeActive which is an observer for app's UIApplicationDidBecomeActiveNotification. Some of those custom URLs must open the login screen first.
My naive approach was to handle all this logic in my main vc's viewWillAppear where I pushed vcs base on the current state. This works for pushing the login screen on app's start without any problem. The problem is that when I return from the login and I need to push another vc. The main navigation controller knows that something was pushed (the back button becomes visible) but the old vc is visible (the main), with partially broken views, and does not react to touch events. Tapping the back button makes a complete mess from my app.
I googled and the problem seems to be that we cannot push a vc while another one is popping. I have found a BufferedNavigationController, which solves this, but it does not work correctly under iOS7 yet. I do not even see any logs in device's console.
Another issues is that while the app is in the background a memory warning could mess my vc's and the app has completely different startup than a normal resume from the background.
At the moment I came with a quick hack where I create a custom backstack for all the situations and set it as the navigation controller's back stack and push the last vc on top of that stack. Then in the login/register screens I modify the backstack if a user skipped the login/register process. This is an ugly hack an not a very future proof solution. I would like to centrally controll the pushing of vcs in one place and there cannot be any visible transition between them in that situation.
Is there any better/more robust solution to achieve this? I cannot have visible transition when returning back from one vc (this is animated) and the vc beneath it should push another on top of it while it becomes visible (no animation of this push). So it looks like we return to a completely different screen? No matter if it can be confusing for users, that is for another question.
EDIT 1: I am targeting iOS7 and newer only.
EDIT 2: Here is a sample demo which shows my issue. I directed the link to he main vc, which pushes other vcs in its viewWillAppear (the other vcs are not important). It is just for presentaion purposes.
This demo shows logs into console "nested push animation can result in corrupted navigation bar" and "Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted." which do not show up in my big project. I know what they mean, but how can I push a vc when antoher is popping away? The mentioned BufferedNavigationController does not work for me on iOS 7 (and it is not a problem, that it does not use ARC).
EDIT 3: When I start the provided demo for the first time, it will open the login screen instead of the main - good. Then after tapping the login it goes back to the main screen and should instantly push the another screen without the main being visible. It does not do that, the main is visible but the navbar thinks there is something above the main, thus the visible back button. It corrupts the backstack...
https://stackoverflow.com/a/20947860/1405008
Refer this for your first scenario like open login or other view controller.
For custom URL u can also use the same logic and check and present when its arrive from custom URL.
Always set the root view Controller will the easiest way to do this kind of different navigation stuffs in Your application also this approach avoid unwanted view-controller in stack.

UIPageViewController and off screen orientation changes

My app is a tab bar application running on iPad.
One of the tabs contains a UIPageViewController, which I implemented pretty much as per the tutorial here: Implementing UIPageViewController programmatically – without storyboarding.
Everything works great, including rotation. However there is a problem - if I go to the tab containing the page view controller, then navigate to a different tab and change the orientation. Then navigation back to the tab containing the page view controller, it is now displayed incorrectly.
Rotating the device again, with the page view controller visible, fixes things.
I guess this is because
pageViewController:spineLocationForInterfaceOrientation:
is not called while that tab is not visible. Any ideas on how to remedy this?
I had the same problem and ended up doing the same workaround. When I was done I didn't really hate it though, because it allowed me to free-up the UIPageViewController and all of it's child UIPageViewControllers and all of their resources when the user wasn't actively using the tab.
I worked around this by re-initialising the UIPageViewController inside viewWillAppear:animated. Not ideal, but it works...

Resources