当前位置:  开发笔记 > 编程语言 > 正文

iPhone + CGAffineTransFormRotate(pi/2)+ statusBarHidden:YES + presentModalViewController = 20像素的空白区域

如何解决《iPhone+CGAffineTransFormRotate(pi/2)+statusBarHidden:YES+presentModalViewController=20像素的空白区域》经验,为你挑选了1个好方法。



1> Alex Wayne..:

我想你可能需要重新进入你的中心:

// Set the center point of the view to the center point of the window's content area.      
self.view.center = CGPointMake(160.0, 240.0);

这是我用于横向视图的整个init方法,并且没有问题.只需确保将笔尖设置为正确的尺寸.

// Implement viewDidLoad to do additional setup after loading the view.
- (void)viewDidLoad {
  [super viewDidLoad];

  // Rotate to landscape
  self.view.frame = CGRectMake(0, 0, 480.0, 320.0);
  if ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeRight) {
    CGAffineTransform transform = self.view.transform;

    // Set the center point of the view to the center point of the window's content area.      
    self.view.center = CGPointMake(160.0, 240.0);

    // Rotate the view 90 degrees around its new center point.
    transform = CGAffineTransformRotate(transform, (M_PI / 2.0));
    self.view.transform = transform;
  }
}

推荐阅读
李桂平2402851397
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有