若要在你的子视图的位置和大小细粒度的控制,当iPhone旋转,改变子视图的框架中的UIViewController方法willAnimateRotationToInterfaceOrientation:duration:
。这个方法在一个动画块中被调用,所以你在其中创建的子视图框架的所有更改都是动画的。
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {
// Portrait frames
self.subviewA.frame = CGRectMake(x, y, width, height);
self.subviewB.frame = CGRectMake(x, y, width, height);
self.subviewC.frame = CGRectMake(x, y, width, height);
} else {
// Landscape frames
self.subviewA.frame = CGRectMake(x, y, width, height);
self.subviewB.frame = CGRectMake(x, y, width, height);
self.subviewC.frame = CGRectMake(x, y, width, height);
}
}
来源
2011-05-24 06:03:51
EJV
就是这样,谢谢。我试图设置变形属性,但表现出一种奇怪的方式。 – 2012-05-18 10:46:34