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