簡體   English   中英

當動畫塊位於子視圖之后時,UIView不會移動子視圖

[英]UIView does not move a subview when a animation block is after it

我有這個UIView類。 它具有4個視圖:

  1. self.view類本身的視圖。
  2. 在上面的twitterButtonView之上:
  3. 按鈕的UIImageView
  4. 上方是按鈕背面的隱藏視圖。

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM