Iphone视图被切断了

时间:2011-02-19 07:44:21

标签: iphone view landscape

我的风景子视图被前一个观点所截断,为什么会这样?

即使添加了新的子视图,在前一个视图中的截断位于屏幕1/3左右的底部。这样的事情> http://i41.photobucket.com/albums/e253/welzenn99/123.png

2 个答案:

答案 0 :(得分:0)

您需要在

中设置该视图的框架
  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

 - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;

答案 1 :(得分:0)

在你告诉子视图出来的方法中([self.view addSubview:someView.view];)add

UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if ((orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight)) {
    //rotate to landscape
    someView.view.frame = CGRectMake(0,0,480,320);
}
else if (orientation == UIDeviceOrientationPortrait) {
    //rotate to portrait 
    isomeView.view.frame = CGRectMake(0,0,320,480);
}

为我工作。祝你好运