Reputation: 3015
I have a textfield on the view controller. I want to populate the form after user taps the textfield. here is the animation which I want to implement
I want to know first did this app using two controllers. or it just using one controller in which it hides the form and open the next form after hiding first one. lets say if its using two controllers how can I open the second controller with animation like this image and also go back to 1st controller with animation.. at the moment I am simply opening a 2nd controller with default animation
func textFieldShouldBeginEditing(textField: UITextField) -> Bool {
self.navigationController!.pushViewController(self.storyboard!.instantiateViewControllerWithIdentifier("LoginViewController") as UIViewController, animated: true)
return false
}
Upvotes: 0
Views: 293
Reputation: 3223
The way they use it is very rather complex in terms of graphics but this more or less it:
1-They use two different view controllers, as should any good, organized programmer.
2-They then define a custom segue that performs the transition from to the other. The custom segue also takes care of animating the transition. Now I speak from experience when I say this: the whole modal segue animation framework is a pain, but it the only way to get those custom segue transitions working right. The way it happens is, you will overlay your second view controller on top of the first one, and then tell a custom animator what to do with individual elements and their frames, using that animator for your segue -- in this case squishing those buttons and expanding those two text fields.
As a full fledged beginner guide I may recommend: http://netsplit.com/custom-ios-segues-transitions-and-animations-the-right-way
I may also advise that the little tutorials out there that simply create a custom segue and animate the views before calling presentViewController: are very tempting but you will spend a good amount of time dealing with bugs, time wasted in the end because it will never be perfect.
Upvotes: 1