0
這是我用於動畫的代碼。UIView動畫不會移動視圖
NSLog(@"SlideLoadingViewOut : frame: X:%f, Y:%f", self.loadingView.frame.origin.x, self.loadingView.frame.origin.y);
[UIView animateWithDuration:time animations:^{
self.loadingView.frame = CGRectMake(320, 0, self.loadingView.frame.size.width, self.loadingView.frame.size.height);
NSLog(@"SlideLoadingViewOut : frame: X:%f, Y:%f", self.loadingView.frame.origin.x, self.loadingView.frame.origin.y);
} completion:^(BOOL finished) {
NSLog(@"SlideLoadingViewOut : frame: X:%f, Y:%f", self.loadingView.frame.origin.x, self.loadingView.frame.origin.y);
}];
這是在控制檯輸出我得到:動畫開始
前:
SlideLoadingViewOut : frame: X:0.000000, Y:0.000000
在動畫塊:
SlideLoadingViewOut : frame: X:320.000000, Y:0.000000
在完成塊:
SlideLoadingViewOut : frame: X:0.000000, Y:0.000000
該視圖不移動。任何人都知道爲什麼會這樣。