2013-02-21 95 views
1

我有一些視圖和圖像視圖。UIView在設備旋轉後停止動畫

_contentView = [[UIView alloc] initWithFrame:self.bounds]; 
_contentView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; 
.... 

UIImageView *imageView = [[UIImageView alloc] initWithImage:someImage]; 
[_contentView addSubview:imageView]; 

此imageView運行一些動畫。

[UIView animateWithDuration:1.6f delay:0.0 options:UIViewAnimationOptionAllowUserInteraction |UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat animations:^{ 
    imageView.center = somePoint; 
} completion:^(BOOL finished) { 

}]; 

問題是旋轉動畫停止後。如果我將_contentView的自動調整大小的掩碼更改爲靈活的邊界動畫,並在旋轉後繼續。但我需要它與靈活的大小。 有人可以解釋爲什麼動畫在旋轉後停止?

回答

0

當動畫正在播放時以及在動畫之後,禁用設備旋轉,如果在動畫期間旋轉了設備,則旋轉屏幕。這應該可以解決問題。

+0

我試圖找到解決或解釋與普通設備旋轉 – 2013-02-21 16:26:50

+0

嘗試在設備旋轉暫停和恢復它的旋轉完成後。 – moray95 2013-02-21 16:29:01

0

我有同樣的問題,也許你使用這個void?只需設置[UIView setAnimationsEnabled:YES]再次激活動畫。我希望這個解決方案對你有幫助。

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { 
    [UIView setAnimationsEnabled:NO]; 
}