I have such view hierarchy. My Window rootViewController is TabBarController with some nice background image loaded into ImageView.
Now on top of it I want to have under one TabBar the NavigationController. Every View Controller in this NavigationController stack must have transparent view (so the image on the back of TabBarController is visible) so I set on all view controllers in NavigationController stack view.backgroundColor to UIColor.clearColor().
The background image is visible. But this kind of displaying ViewController breaks the PUSH/POP transitions in the NavigationController.
The problem is when pushing from vc1 to vc2 that vc1 is moving to the left a little during transition and the suddenly dissapears.
When vc2 is not transparent the animation of vc1 is not visible because it's under vc2 and it's visually ok but when vc2 is transparent (and in this case must be) the animation of vc1 is visible. How to change this behaviour so I can have fluent animation on vc1. I would like to vc1 move the way it moves but also it should fade away fluently.
Second question:
I tried to add custom transition to my NavigationController by its delegate method
func navigationController(
navigationController: UINavigationController,
animationControllerForOperation operation: UINavigationControllerOperation,
fromViewController fromVC: UIViewController,
toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return self
}
I have implemented simple transition but when I executing PUSH via:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
performSegueWithIdentifier(AbstractContactController.showContactProfileSegue, sender: nil)
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
I have the following error and apps is crashing after tapping on the table cell.:
warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.
The error is arise only when I'm using my implementation of Navigation Controller and here is implementation of it:
class MyNavigationController: UINavigationController {
override func viewDidLoad() {
super.viewDidLoad()
self.delegate = self
}
}
extension MyNavigationController: UINavigationControllerDelegate {
func navigationController(
navigationController: UINavigationController,
animationControllerForOperation operation: UINavigationControllerOperation,
fromViewController fromVC: UIViewController,
toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return self
}
}
extension MyNavigationController: UIViewControllerAnimatedTransitioning {
func transitionDuration(transitionContext: UIViewControllerContextTransitioning?) -> NSTimeInterval {
return 1.0
}
func animateTransition(transitionContext: UIViewControllerContextTransitioning) {
transitionContext.completeTransition(true)
}
}