I'm having trouble using the technique found here: http://dativestudios.com/blog/2013/09/29/interactive-transitions/ while presenting the destination view controller modally.
When set to modal, it doesn't even call the delegate we've setup.
Is there some fundamental difference in Modal presentations that means this won't work?
I think you should set the modal view controller to UIModalPresentationCustom before displaying as the following code
modalVC.modalPresentationStyle = UIModalPresentationCustom;
here is a complete example project for displaying a transparent modal view controller with custom transition:
https://github.com/merocode-com/CustomTransitionExample
Related
I have two UITableViewControllers that are connected via a Show segue. The prompt property of UINavigationItem is set on both view controllers in Interface Builder. When the first view controller is shown, the prompt and navigation bar are both displayed properly, however, when performing a segue to the second view controller, the title and the back button animate undesirably. I have tried setting the prompts programmatically in the viewWillLayoutSubviews, viewDidLayoutSubviews, viewDidLoad, viewWillAppear:, and the viewDidAppear: methods of both view controllers, but I get the same effect.
Any ideas on how to resolve this issue? I don't want to resort to a custom view for the titleView because I prefer the stock functionality, but I am not able to figure out how to fix the undesirable animation.
Here is a video if the animation in question.
Well, it looks like this is an issue with the way that the UINavigationItem is laid out when showing the next view controller.
According to Catalina T. in an answer to a similar question, making two calls to set the hidden property of the navigation bar to true and then again to false in viewWillAppear: seems to get by this issue.
Im trying to present a modal view controller from subclass of UITabBarController. I present it from viewDidLayoutSubviews method. Everything works fine on iOS 7 but in iOS 8 when app stars i still breafly see TabBarControllers first tab.
TabBarController is set as initial view controller in storyboard.
Is this even a good way to present it or there is something for iOS 8 that i dont know?
I don't have the rep to post a comment, so I'll seek clarification and provide guidance through this answer.
Is the intention that the modally presented view controller will be the first thing people see when they launch the app? And then I suppose it gets dismissed, and behind it will be the tabbar controller? How is your storyboard currently set up for the modal view controller if the tabbar is set to be the initial view controller?
One place to start could be to move to code to viewWillLoad or viewDidLoad rather than viewDidLayoutSubviews. I could also suggest to just make the modal VC the initial view controller
I'm developing an iPad app where I've created a custom segue to present my view controller with a custom animation. It's now working (almost) fine and in the end it looks like a form modal view controller, exactly how I wanted it to look.
Now I need to create a custom animation for dismissing the modal view controller that matches the first animation.
What is the best way to do it? I have my custom animation inside my custom segue and I think the reverse animation should be there also. But I also think the segue is not the place to have it.
How'd you guys do it?
Thanks
Unfortunately you can't use the segue to perform the dismiss of your modal ViewController its jut one way (will change in ios6). just perform your custom dismiss-animation and call dismissModalViewControllerAnimated:NO on the parentViewController in the finished block of the animation.
I'm having trouble to achieve the following using a storyboard:
When setup is not done:
run app -> show settings view controller -> show main navigation controller
When setup is done:
run app -> show main navigation controller
So basically, I want the app to programmatically start with the settings view in certain cases, and otherwise skip right ahead to the main navigation controller.
I did manage to show the settings view with a modal style segue from the main navigation controller, but I don't know how to display it before the main navigation controller is displayed. Any ideas?
By default, the initial view controller from your main storyboard is instantiated and displayed automatically when your app starts up. To prevent this happening you need to remove the UIMainStoryboardFile setting from your info.plist file.
With no default view controller, you are now free to create one programmatically at app startup. See the UIStoryboard documentation. Use +storyboardWithName:bundle: to load the storyboard and then use –instantiateViewControllerWithIdentifier: to create the correct view controller. You will also need to create a main UIWindow and add the view controller's view to it just like you used to do with .nib based UI. Note that without the UIMainStoryboardFile setting a main window is not created for you - read the explanation.
I managed to do it a bit different:
Use a UINavigationController as the initial view controller.
Create a root view controller that will manage the decision of what to load.
Create a Storyboard Segues from the root view controller to the main view and to settings view, and give the segues proper identifiers.
Call the performSegueWithIdentifier with the proper identifier from your root view controller.
Just another solution, hope this helps.
I did something similar to amoshaviv, his advice is sound. I did it slightly different though, and I'll give some more info.
I created a custom MyInitialViewController class, derived from UIViewController, and made this the initial view controller.
In the storyboard file, I created modal segues with appropriate names to all (in my case three) possible 'real' first view controllers.
In the MyInitialViewController class, I implemented the
- (void)viewDidAppear:(BOOL)animated;
method, to first perform the check which view to switch to, and then do the correct
[self performSegueWithIdentifier:#"NameOfSegue" sender:self];
Effectively, this makes the MyInitialViewController nothing more than a switch performed when it's brought into view. I first tried doing this when loaded because I don't care for actually seeing this view, but that did not work, while viewDidAppear does.
To make this visually smooth, I tried the following. In the properties of the segues, I disabled animation. The view I left empty, and I gave it a background color matching to that of the startup image.
I have a couple of UIViewController subclasses. One that displays a grid and another that is essentially the 'detail view' for the tile on the grid. The user taps a tile and the detail view expands from the grid to fill the screen.
I have managed to get the views to animate properly and can display the content of each view perfectly. My problem comes when the device is rotated. I have displayed the detail view as a subview of the gridview and so when I rotate the device, the grid view controller gets the rotation calls, not the detail view.
As this is a custom animation, I couldn't use the standard pop and push view controller methods. Is there an method that I have to call to make this view controller responsible for handling rotation until it is dismissed?
Thanks
If I understand correctly, you rotate your grid view controller and it responds, but the 'detail view' view controller doesn't change correctly?
If this is the case, there are two possible solutions I can think of (and currently use myself). One solution would be to register the 'detail view' for a notification. Whenever the grid view controller is rotated, send the notification and the 'detail view' should respond as you want it.
The other solution is just a simple check when the 'detail view' is loaded.
if (self.view.bounds.size.height < self.view.bounds.size.width) {
// apply the code you wish to size it for landscape mode;
}
This, of course, would only work if the 'detail view' is not currently visible when the screen is rotated, so sending a notification may be a better choice to cover all possibilities.
You could set up a custom delegate in the grid view controller and register the detail view controller as that delegate after it is set up. In the grid view controller you then implement willRotateToInterfaceOrientation:duration: and didRotateFromInterfaceOrientation: which first call the corresponding methods in the delegate (the detail view controller) and then in super.