Adapting between two different UIPresentationController's - objective-c

I would like to adapt between two different UIPresentationController, according to the current trait collection. For example, the two controllers could be UIPopoverPresentationController for any traits and a custom UIPresentationController for compact horizontal traits (e.g. iPhone).
Unfortunately this doesn't seem possible in the latest iOS 8. In particular:
You can set a UIAdaptivePresentationControllerDelegate to swap out the presentation style, but only permits the standard full screen presentation controller.
You can choose which presentation controller to use just before presenting the view controller, but this doesn't actually adapt after presenting when the traits collection changes e.g. in iPad multitasking or orientation change.
A couple of different attempts at a solution: Tumblr, Irace
Any suggestions?

To assume you require two presentation controllers for adaptation is a false assumption.
There is only one presentation controller and you have to adapt the view and/or the transition using the delegate methods. For the custom transition you simply set a transition delegate class on the view controller you return from viewControllerForAdaptivePresentationStyle which in my case was a navigation controller with a transparent dimmed view with table at bottom and done button in the right nav item. My custom transition moves the table up from the bottom, while dimming and resizing the dimmed view, and fading in the nav bar. If you would like to see the behaviour yourself run Maps and tap the bottom right info button and try it on iPhone and iPad, I've copied that exactly. Here are screenshots of compact and regular:

Related

Adding an animated, modal popup view

I'd like to create a view that appears scrolling in from the bottom (on iPad) and sits centered, modally over the currently open view, something like this ...
What would be the straightforward (and recommended) way to do this when developing apps for iOS7 and up? Is it a matter of simply instantiating the view controller class and adding it as a child or are there any better methods to do this, that include automatically managed modality and animation (like for example when adding an UIPopoverViewController)?

UIPageViewController set additional actions on pan/swipe

I use an UIPageViewController to pan between three views.
I want to blur the background of the third view when I pan from the second to the third view (and vice versa).
Therefore I have attached an additional UIPanGestureRecognizer to the second view.
This UIPanGestureRecognizer animates the alpha-property of an image view which contains a blurred representation of the background image from 0.0 to 1.0 as soon as the right border of the second view has passed the middle of the screen. An additional UIPanGestureRecognizer of the third view does the opposite when I pan from the third to the second view.
Unfortunately this behavior is static. The panning of the UIPageViewController is interactive.
When I want to pan from the second to the third view and the right border of the second view passes the middle of the screen, the burred image view gets visible while I'm panning. But while I'm panning I can change my mind and cancel the transition when I pan back to the original position. The blurred view stays visible although the second (and not the third) view is on screen.
Similar problems occur when I pan very fast a too short distance. The UIPageViewController will move to the third view but the blurred image view stays invisible.
Is there any way to synchronize the transition of the views with the visiblity/invisibility of the burred image view?
The UIPageViewController delegate protocol has two interesting methods:
pageViewController:willTransitionToViewControllers:
pageViewController:didFinishAnimating:previousViewControllers:transitionCompleted:
Unfortunately both methods doesn't work for my purposes.
The UIViewControllerAnimatedTransitioning feature of the iOS 7 SDK also seems not to work with the UIPageViewController.
Has anyone an idea?
Sounds like iOS7 feature UIViewControllerInteractiveTransitioning (which also encompasses the associated non-interactive animated transitioning) is indeed what you need. You might consider replacing your UIPageViewController with some other mechanism that can make use of this approach, such as UINavigationController.

How to recreate Jetsetter's iOS teaser photo & photo viewer slideshow transition?

One of the more impressive iOS app that I've come across is Jetsetter's due to its great design, incredible interface, and creative uses of animation. One of my favorite components of the app is the teaser photo interface they have for the hotels/venues. They provide a minimized photo slideshow, but if you want the full view you can click it and it expands to expose a larger version of the image. You can see a blurry video of this in action here.
I'm interested in recreating something similar. I'm well aware of the paged galleries like MHPagingScrollview (which is how the larger photo viewer functions), yet what I'm trying to figure out is the proper way to handle the transition. I've also seen libraries that handle the Ken Burns effect for images. However what is not clear is whether or not there are separate view controllers.
Is this a transition between two separate view controllers? Or would the minimized and maximized photo viewer be part of the same controller? How would you most efficiently replicate something similar? I've embedded a screen shot below to illustrate the before and after. The video linked above however most effectively illustrates this transition.
Mobile engineer from Jetsetter here. They are two separate controllers, but the transition animation occurs in the first. Here's the flow:
A user taps the smaller photo.
A transition view containing the full size image is placed directly on top of the smaller image.
The transition view animates to the bounds of the screen.
The photo viewer controller is presented as a modal without animation, completing the effect in one seamless animation.
The effect is reversed when the modal controller is dismissed.
The trick lies in your transition view. We created a UIView subclass (with clipsToBounds enabled) that contains an imageView. The bounds of the transition view expands to reveal the imageView, resulting in no distortion of the final image during the animation.

Is there another way than presentModalViewController to show a UITabBarController on just part of the screen?

I have a UITabBarController displaying a number of settings-screens in my app. I want them to be shown on just a part of the screen for layout reasons. In fullscreen, the lists become unreadable (too wide), there are just a few controls per page making the page feel very empty, and the tabbar buttons are far away from the content (Fitts law).
Using presentModalViewController with the UIModalPresentationFormSheet style gives me the size I want. I do this on top of an empty background, since in my case it doesn't make sense to display anything behind it. The "real" working area is displayed with another presentModalViewController in fullscreen mode on top of it all.
This works but feels like a hack. One problem is, I can't make the background behind the settings dialog move in the transition to fullscreen with the UIModalTransitionStyleFlipHorizontal style.
TL;DR
Can I embed a UITabBarController non-fullscreen in another "background"-view? I can't find any information of how I would do this.
Can I embed a UITabBarController non-fullscreen in another "background"-view? I can't find any information of how I would do this.
Why don't you try it out?
Create a container view of the size you want the tab bar controller to have.
Create the tab bar controller.
[containerView addSubview:tabBarController.view];

ABPeoplePickerNavigationController inside a view?

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.