2010-05-25 61 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)的原点。