Seb
Seb

Reputation: 3564

iOS transitioning views using animation blocks

I am trying to animate between 2 subviews. At the moment I've tried different options, each with their own side effects.

The application is a small game with a skills subview, an inventory subview, and a status subview. I want to animate between the skills and the inventory views while leaving the status subview on the bottom of the main view. Below I've listed my various attempts and the side effects from them.

The views are loaded into the main view just hidden in the background and they used to just pop into the main window. However, I would like to animate between the views to have a better application flow. I've seen people remove and add to the main view, but I'm hoping that setting the subviews to be visible/invisible should have the same effect.

Any advice is greatly appreciated.

Upvotes: 0

Views: 425

Answers (1)

Steve
Steve

Reputation: 31662

Core Animation doesn't know how to animate those views apart from their direct ancestor (parent).

Break them into a single container view.

Eg:

Instad of this:

Parent
 - Other View
 - View A
 - View B
 - Other View

Have this:

Parent
 - Other View
 - Container
   - View A
   - View B
 - Other View

See comments to question for more detail.

Upvotes: 1

Related Questions