Dismiss custom modal view controller - objective-c

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.

Related

Modal view before UITabBarController

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

Custom Transition with "UIViewControllerAnimatedTransitioning" not working if "Present Modally" segue used

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

Custom segue - Individually animate UINavigationBar and UITableView

Is there a way to use custom segues to individually animate several different subviews.
For example, I want my modal view to appear by the UINavigationBar fading in (as the source destination's UINavigationBar fades out) and then a UITableView to slide down the screen 'over' the source destination's view controller.
When I try to implement this in the - (void)perform method. My properties don't animate using [UIView animateWithDuration: animations: completion:].
Can anyone provide me with a solution?
Thanks in advance!
You can certainly use custom segues to achieve this - however, I don't think you'll get much help without more details about the setup of your view controllers.
Everything you describe is correct: to create a custom segue you animate the views inside your sourceViewController and destinationViewController inside the segue's perform: method. If they're not animating you might want to check that your segue is actually getting called (you can use breakpoints in the debugger to check this), or that the views you're trying to access inside your view controllers actually exist at that point in time (again, something you can check using the debugger).
For a solution specific to your app you're almost certainly going to have to provide more details about the two view controllers you're trying to transition between. Perhaps you could post your perform: method.

add or present view before launching first tab view controller

I am making an iPhone app in which I have used both, the navigation as well as the tabbar controller. Now after splash screen I want to show a UIView before showing the first view controller of the tab bar.
Currently I have added one subview on first tabBar controller. But this view gets messed up with the first tabBar controller's view.
Can anyone tell me that is it possible to add or present a UIView before launching the tabBar controller? If anyone has an idea please do let me know.
Use the storyboard. Make your additional view the first scene. Add a segue to the tab view. If you want an automatic transition, trigger the segue by a timer.

Objective C - Create modal Segue

I'm having some trouble figuring out how to use the Storyboard correctly. My main issue being Modal segues. I have a viewcontroller which I'm trying to display modally (far right in image below). But it just isn't showing. The prepareForSegue is firing correctly.
It does work when I change the segue from a Modal to a Push though.
I'm calling the segue using
performSegueWithIdentifier:#"FirstRunSegue" sender:self
Here is the visual segue setup I have at the moment
When I hover over the Excaimation mark, the following error is displayed:
I am kind of new to Storyboarding, so I'm hoping that someone could explain why the modal segue isn't working and how I would get it to work. The nasty thing is that it is a requirement for the viewcontroller to be in the Storyboard, otherwise I'd just initialize the controller and display it manually.
Regards,
EZfrag
Edit 1:
OK, I managed to figure out why the segue is not being displayed. It is kind of stupid, because it works for a push. It seems that I cannot call a modal segue from the appdeletegate's startup function. Push works fine, but not modal. Confirmed it with a new project.
Is there someone that can explain why this is so?
Regards,
EZFrag
You can only use the push segue with a UINavigationController, but it looks like you are trying to use it between two regular UIViewContoller. If you want to change the way the animation looks, use a custom segue and write your own transition.