[英]UIView does not move a subview when a animation block is after it
我有這個UIView
類。 它具有4個視圖:
self.view
類本身的視圖。 UIImageView
。 self.view
的框架為(30, 380, 68, 66);
self.view
(30, 380, 68, 66);
我希望能夠UIViewAnimationTransitionFlipFromRigh
該按鈕,然后將其放大並伴隨UIViewAnimationTransitionFlipFromRigh
t。 在動畫開始之前,我將類的框架設置為整個屏幕。 (我必須這樣做,以便班級仍然要響應觸摸),這就是我的按鈕移至左上方的位置。 我正在做一個twitterButtonView.center = somePoint
並且按鈕視圖沒有任何反應:(我刪除了不重要的部分)
// I save the center of the class. Its where the the class is in the window.
oldCenter = self.center;
self.frame = CGRectMake(0, 0, 320, 480);
// Set the button to the position where the class was.This is x=63 y=413 in the debugger
// If I return; after this everything is fine and the class has the frame set to the whole
// screen and the button is at 62,413
twitterButtonView.center = oldCenter;
[UIView beginAnimations:@"twitterButtonFlip" context:nil];
[UIView setAnimationDuration:1.0];
twitterButtonView.center = CGPointMake(160,220);
[UIView commitAnimations];
按鈕移到中間。 但是動畫的起點是34,33。 這是為什么?
因為self.view中心是34、33。
而是嘗試更改幀的原點(x或y)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.