transitionFromView and indexes
I'm working with a controller (MAIN) that manage how presents 2 other controllers (A and B) views in its main view. In MAIN controller View i have a BUTTON created into the MAIN view xib. BUTTON must be over A and B view.
So this's the view hierarchy structure i need :
MAIN.VIEW
|------A or B view (index 0)
|------BUTTON (index 1)
Here how i create A and B into MAIN:
//MAIN CONTROLLER viewDidLoad
- (void)viewDidLoad {
[super viewDidLoad];
self.A = [[A alloc] init];
self.B = [[B alloc] init];
//Start from A view visible in MAIN
[self.view insertSubview:self.A.view atIndex:0];
}
After a specific action call i want to insert controller B view and remove A. I read about transitionFromView and i tried to use it this way:
[UIView tr开发者_开发百科ansitionFromView:self.A.view
toView:self.B.view
duration:1.0
options:UIViewAnimationOptionTransitionFlipFromRight
completion:^(BOOL finished) {
if (finished) {
//nothing for now...
}
}];
The problem here is that after flip animation B view is over BUTTON and doesn't take exactly the place of A in my hierarchy (A was at index 0)
I can add this code into completion Block :
[self.view sendSubviewToBack:self.B.view];
But i think it's a little tricky solution :P (and it's not a good solution too, because it seems appear effectively at the end of the animation with a bad graphic effect...)
Which is the best way to be sure that A and B are placed at index 0 ?
May be a bug in the SDK. There is a Bug report at OpenRadar with exactly this behaviour.
精彩评论