Reputation: 43
Im trying to animate my containerView when present other one in the middle of the screen. But I do not get it. If only animate the view, the navBar dont do nothing, if I animate both it dislodges.
When I only animate the view its look like this
When I animate the navigationBar its look like this
An this is my code
let datePickerController = self.storyboard!.instantiateViewControllerWithIdentifier("DatePickerViewController") as! DatePickerViewController
let navController = UINavigationController(rootViewController: datePickerController)
navController.modalPresentationStyle = UIModalPresentationStyle.Custom
navController.transitioningDelegate = self
UIView.animateWithDuration(0.3, delay: 0.0, options: UIViewAnimationOptions.CurveEaseInOut, animations: {
self.view.alpha = 0.5
self.navigationController!.navigationBar.alpha = 0.5
self.view.transform = CGAffineTransformMakeScale(0.9, 0.9)
//NavigationBar animattion
// self.navigationController!.navigationBar.transform = CGAffineTransformMakeScale(0.9, 0.9)
self.presentViewController(navController, animated:true, completion: nil)
}) { (Bool) in
}
Upvotes: 1
Views: 58
Reputation: 43
I fix it, the solution is change this lines
self.view.alpha = 0.5
self.navigationController!.navigationBar.alpha = 0.5
self.view.transform = CGAffineTransformMakeScale(0.9, 0.9)
//NavigationBar animattion
// self.navigationController!.navigationBar.transform = CGAffineTransformMakeScale(0.9, 0.9)
by these
self.navigationController!.view.transform = CGAffineTransformMakeScale(0.93, 0.93)
self.navigationController!.view.alpha = 0.5
Upvotes: 1