Iphone UIView动画的景观问题
我有一个UIViewController,它有一个UIView,我把它添加到一个nib文件中。这是一个iPad项目。我想设置动画,以便在加载视图时,此UIView从底部到中心显示,因此我执行了以下操作:Iphone UIView动画的景观问题,iphone,objective-c,ios,ipad,uiviewanimation,Iphone,Objective C,Ios,Ipad,Uiviewanimation,我有一个UIViewController,它有一个UIView,我把它添加到一个nib文件中。这是一个iPad项目。我想设置动画,以便在加载视图时,此UIView从底部到中心显示,因此我执行了以下操作: [self.containerView_ setFrameY:self.view.bounds.size.height]; [UIView animateWithDuration:0.6 delay:0.0 options:UIViewAnimationCurveEaseOut anim
[self.containerView_ setFrameY:self.view.bounds.size.height];
[UIView animateWithDuration:0.6 delay:0.0 options:UIViewAnimationCurveEaseOut animations:^{
[self.containerView_ setCenter:CGPointMake(self.view.bounds.size.width/2, self.view.bounds.size.height/2)];
} completion:^(BOOL finished) {
}];
这一切在纵向效果很好,但在横向效果很糟糕,因为containerView的x中心没有真正居中,它有点偏左,因此动画不会在y轴上变换,也会在x轴上变换
我认为问题在于,如果我能让containerView在不考虑方向的情况下居中,那就解决了它。我已经正确设置了自动调整大小的遮罩,使其居中。我认为问题在于横向视图边界仍然是768x1024,而不是1024x768。对此有何想法?检查您的自动重新设计任务,为什么不将动画代码简化为:
[self.containerView\uuuCenter:self.view.center]代码>?如果使用中心属性移动,则可以完全删除autoresizemasks,因为您正在与self.view.bounds进行比较,后者应始终正确设置。