状态栏下绘制的视图

发布于 2024-10-30 23:21:06 字数 644 浏览 0 评论 0原文

因此,当有人按下按钮时,我设法加载另一个视图,但它会将其加载到高位。 “我不知道为什么会发生这种事。差异恰好是顶部栏的高度。这是我的代码: 在代表中,我有:

- (void)flipToAbout {
AboutViewController *aaboutView = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
[self setAboutController:aaboutView];
[aaboutView release];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES];
[homeController.view removeFromSuperview];
[self.window addSubview:[aboutController view]];
[UIView commitAnimations];}

在“关于”视图中,我没有更改任何内容。请告诉我问题是什么。谢谢。

So i managed to load another view when someone presses a button ,but it loads it to high. `i don't know why this happens. The difference is exactly the top bar hight. This is my code:
In the delegate i have:

- (void)flipToAbout {
AboutViewController *aaboutView = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
[self setAboutController:aaboutView];
[aaboutView release];

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:window cache:YES];
[homeController.view removeFromSuperview];
[self.window addSubview:[aboutController view]];
[UIView commitAnimations];}

In the about view i didn't change anything.Please tell me what is the problemm .Thanks.

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

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

发布评论

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

评论(1

溺渁∝ 2024-11-06 23:21:06

问题是您将视图直接添加到窗口中,而不考虑导航栏。通常,如果您有导航栏,则可以使用导航控制器来管理视图控制器。将视图控制器推送到导航控制器的堆栈上会导致导航控制器将该视图控制器的视图添加到窗口中,并且您不必担心导航栏。不过,由于您是手动执行此操作,因此在将视图添加到窗口后,您需要重新定位视图。

请注意,这个问题与笔尖没有任何关系,除了您从笔尖加载视图之外。如果您以编程方式创建视图,也会发生同样的情况。

The problem is that you're adding your view directly to the window without accounting for the navigation bar. Normally, if you have a navigation bar, you use a navigation controller to manage your view controllers. Pushing a view controller onto the nav controller's stack causes the nav controller to add that view controller's view to the window for you, and you don't have to worry about the nav bar. Since you're doing it by hand, though, you'll want to reposition the view after you add it to the window.

Note that this problem doesn't have anything to do with nibs except that you load your view from a nib. The same thing would happen if you created the view programmatically.

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