`
baobaoupup
  • 浏览: 470534 次
文章分类
社区版块
存档分类
最新评论

iPad开发实现横竖屏幕调整View的尺寸

 
阅读更多

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration {


CGRect apprect;

apprect.origin = CGPointMake(0.0f, 0.0f);

if ((orientation == UIInterfaceOrientationLandscapeLeft) || (orientation == UIInterfaceOrientationLandscapeRight))

apprect.size = CGSizeMake(480.0f, 300.0f);

else

apprect.size = CGSizeMake(320.0f, 460.0f);


// 设置当前控制器所有的sunView的位置

float offset = 32.0f;

for (UIView *subview in [self.view subviews])

{

CGRect frame = CGRectInset(apprect, offset, offset);

[subview setFrame:frame];

offset += 32.0f;

}

}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics