3
由於更新到iOS8,很多動畫已停止工作。看起來視圖的y
位置不能改變。在iOS7中沒有問題。但對於iOS8,它不會超過原來的y
的位置。看起來,視圖的框架確實正在更新,但框架未被重繪。這裏是我的代碼UIView transitionWithView&設置框架不再有效iOS8
[UIView transitionWithView:self.view duration:0.3 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.table.frame = CGRectMake(0, (self.view.bounds.size.height - self.button.frame.size.height) - (252), self.view.bounds.size.width, self.table.frame.size.height);
} completion:nil];
我也試過這段代碼在動畫塊之外;
self.table.frame = CGRectMake(0, (self.view.bounds.size.height - self.button.frame.size.height) - (252), self.view.bounds.size.width, self.table.frame.size.height);
如果有人也堅持這一點,那麼不要使用[self.viewToAnimate layoutSubviews];內部動畫塊,因爲它不工作。使用[self.viewToAnimate layoutIfNeeded];代替。 – Borzh 2015-04-20 17:24:10
@Borzh多數民衆贊成在什麼原始答案說? – DevC 2015-04-20 18:46:39
是的,我只是想強調layoutIfNeeded方法是必要的,而不是layoutSubviews。問題是layoutSubviews在iOS 7.1上工作,而在iOS 8+上沒有 – Borzh 2015-04-20 18:48:52