0

I'm working on an app that uses a UITabBarController, where each tab contains a UINavigationController stack.

I'm attempting to create a UIDynamicAnimator that will use UIDynamicBehaviors to animate in, from the top, a UIView from under the UINavigationBar, such that it collides with the UITabBarController's UITabBar and pushes it off the screen.

In order to achieve this, my reference view for the UIDynamicAnimator must contain the UITabBarController's view.

Is it okay to use the UIWindow instance as the reference view for the UIDynamicAnimator?

(Please provide feedback on this approach as well, I see others modifying the frame of UITabBarController.tabBar - is that bad practice?)

maelswarm
  • 1,163
  • 4
  • 18
  • 37
Andy Obusek
  • 12,614
  • 4
  • 41
  • 62

1 Answers1

2

Any view will do. All you are doing is setting the frame of reference.

Be aware, however, that the window does not rotate when the device rotates (window coordinates are screen coordinates, and are fixed with respect to the device). Thus, working with its coordinates can be a nightmare.

Given the nature of your question, since everything is happening inside the tab bar controller, I don't see why you don't use the tab bar controller's view. It contains the tab bar and the various views of the child view controllers. If it is the root view controller (as I suspect it is), it contains absolutely everything else, and it itself is not going anywhere.

matt
  • 515,959
  • 87
  • 875
  • 1,141