iOS 7 UIToolBar 覆盖状态栏 [英] iOS 7 UIToolBar Overriding With Status Bar

查看:22
本文介绍了iOS 7 UIToolBar 覆盖状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的项目从 iOS 6 升级到 iOS 7,但似乎有点问题.状态栏和工具栏是最重要的并且彼此非常接近.工具栏早先是通过在故事板中手动拖动它来添加的.这是它的显示方式:

I have upgraded my project from iOS 6 to iOS 7 but there seems a little problem. The status bar and a tool bar is overriding and very close to each other. The tool bar was earlier added by manually dragging it in the storyboard. This is how its showing up:

我看到了一些建议使用positionForBar:"和- (UIBarPosition)positionForBar:(id)bar"的问题,但我不知道如何使用它们,一些解释和简单的方法这样做可能会有所帮助.谢谢!

I have seen a few questions that are suggesting to use "positionForBar:" and "- (UIBarPosition)positionForBar:(id)bar" but i don't know exactly how to use them, a little explanation and easy way to do it might help. Thanks!

更新:以下是一些也需要修复的代码.它之前工作正常,但由于 detailviewcontroller (WebViewController) 现在嵌入在导航控制器中,下面的代码导致异常.看起来我需要修改这个方法的第一行.

UPDATE: Following is some code that also needs a fix. It was working fine earlier but since the detailviewcontroller (WebViewController) is now embeded inside a navigation controller, the below code is causing an exception. Looks like i need to modify the first line in this method.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

        WebViewController *wvc = [self.navigationController.parentViewController childViewControllers][1];
        RSSItem *entry = [[channel items] objectAtIndex:[indexPath row]];
        wvc.title = entry.title;
        wvc.urlString = entry.link;   
}

推荐答案

如果您的设置是一个拆分视图,如具有两个容器视图的设置,您应该能够做到这一点.设置容器视图时,向上拖动顶部,直到您看到表示顶部位于状态栏底部的蓝色虚线.使用两个容器视图执行此操作.将工具栏添加到嵌入式控制器(不是容器视图),固定在该控制器视图的顶部.将左视图嵌入导航控制器后,我的屏幕如下所示:

If your setup is a split view like setup with two container views, you should be able to do this. When you set up the container views, drag the top up until you see the dotted blue line that indicates the top is at the bottom of the status bar. Do this with both container views. Add the tool bar to the embedded controller (not the container view), pinned to the top of that controller's view. With the left view being embedded in a navigation controller, my screen looked like this:

这篇关于iOS 7 UIToolBar 覆盖状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆