Reputation: 12444
In my app when I am switching views with an animation using UIView animations, it does not show anything, the view is black but I know my method is getting called. I have NSLogged where the view is and I printed the results and posted them below.
My code is below, but does anyone see anything that is wrong?
-(void)changeView2ToView3 {
NSLog(@"Before, frame= %@", NSStringFromCGRect(view3.view.frame));
[view2.view.superview addSubview:view3.view];
[view3.view setFrame:CGRectMake(0, kHeight, kWidth, kHeight)];
[UIView animateWithDuration:0.75
animations:^{
[view3.view setFrame:CGRectMake(0, 0, kWidth, kHeight)];
}
completion:^(BOOL finished){
[view2.view removeFromSuperview];
}];
NSLog(@"Before, frame= %@", NSStringFromCGRect(view3.view.frame));
}
kHeight and kWidth are the height and width of the screen and they are never 0 or nil.
Also this is what is printed from the console:
2012-02-02 15:58:30.449 App[27578:707] Before, frame= {{0, 0}, {320, 480}}
2012-02-02 15:58:30.452 App[27578:707] Before, frame= {{0, 0}, {320, 480}}
2012-02-02 15:58:36.234 App[27578:707] Before, frame= {{0, 0}, {320, 480}}
2012-02-02 15:58:36.237 App[27578:707] Before, frame= {{0, 0}, {320, 480}}
Thanks!
Upvotes: 0
Views: 1331
Reputation: 26
A similar thing is happening to me with an app I'm working on. I think what's wrong with yours is that you didn't specify a height or width, they are both 0? Correct me if I am wrong.
Upvotes: 1