1
后,我试图让我的标签显示动画:addSubview动画作品只有第二次
- (void)handleSingleTap:(UIGestureRecognizer *)gestureRecognizer {
if (isShowingRectangleLabel == NO) {
[UIView transitionWithView:rectangleLabel duration:0.5
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^ { [self.view addSubview:rectangleLabel]; }
completion:nil];
NSLog(@"action");
isShowingRectangleLabel = YES;
} else {
[UIView transitionWithView:rectangleLabel duration:0.5
options:UIViewAnimationOptionTransitionFlipFromBottom
animations:^ { [rectangleLabel removeFromSuperview]; }
completion:nil];
isShowingRectangleLabel = NO;
}
}
但这仅动画后第二次增加了子视图的工作。我该如何解决它?
编辑澄清,addSubview
工程,但没有动画。
只是可以肯定:你验证* isShowingRectangleLabel *是当你试图在第一时间设置为NO? –
是的,在'viewDidLoad'中我将它设置为'NO'。 – RomanHouse