iPhone 视图被切断

发布于 2024-10-17 22:08:42 字数 237 浏览 2 评论 0原文

我的景观子视图被之前的视图切断了,为什么会这样?

即使添加了新的子视图,与上一个视图中一样,剪切也在屏幕的 1/3 四分之一左右的底部。像这样的事情> http://i41.photobucket.com/albums/e253/welzenn99/123.png

My landscape subview is being cut off by the previous view, why is it like that?

Cut off as in the previous view is at the bottom part around 1/3 quarter of the screen even when the new subview is added. Something like this > http://i41.photobucket.com/albums/e253/welzenn99/123.png

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泪意 2024-10-24 22:08:42

您需要在

  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

OR中设置该视图的框架

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

you need to set that view's frame in

  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

OR in

 - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
无人问我粥可暖 2024-10-24 22:08:42

在告诉子视图出来的方法中 ([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);
}

对我有用。祝你好运

in the method where you tell the subview to come out ([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);
}

worked for me. good luck

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文