2010-05-25 35 views
1

我有這個UIView類。 它有4查看:當動畫塊在它後面時,UIView不會移動子視圖

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

self.view具有(30,380,68,66)的框架;

我希望能夠標籤按鈕,然後它隨着UIViewAnimationTransitionFlipFromRight放大。在動畫開始之前,我將該類的框架設置爲整個屏幕。 (我必須這樣做才能讓班級對觸摸做出響應)這就是我的按鈕移動到左上角的地方。我做了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。這是爲什麼?

回答

0

因爲self.view中心是34,33。

改爲嘗試更改幀(x或y)的原點。