iOS7 UIScrollView在状态栏下方显示偏移量内容 [英] iOS7 UIScrollView show offset content below status bar

查看:658
本文介绍了iOS7 UIScrollView在状态栏下方显示偏移量内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发我的应用程序以使用iOS7。
我有一个UINavigationController我正在推动一个内部有ScrollView的UIViewController。在scrollView里面我有一个tableView。
当我在scrollView中滚动tableView时,可以实现这一点,列表将显示在状态栏后面。同样的原因,如果我有一个UINavigationController和一个带有tableView的UIViewController。

I'm developing my app to work with iOS7. I have a UINavigationController I'm pushing a UIViewController that has a ScrollView inside it. Inside the scrollView I have a tableView. Is it possible to achieve that when I scroll the tableView inside the scrollView the list will appear behind that Status bar. Same why it would be if I had a UINavigationController and a UIViewController with a tableView in it.

所以这就是层次结构:

UINavigationController - > UIViewCOntroller - > UIScrollView - > UITableView。

UINavigationController -> UIViewCOntroller -> UIScrollView -> UITableView .

我希望当用户滚动表格时,顶部的单元格将在状态栏下显示。

and I want that when a user scroll the table,the cells in the top will be visible under the status bar.

如果没有UISCrollView,它会在iOS7中自动发生。

If there is not UISCrollView it happens automatically in iOS7.

谢谢。

推荐答案

只需将 automaticAdjustsScrollViewInsets 设置为在viewController init方法中。

Just set automaticallyAdjustsScrollViewInsets to NO in the viewController init method.

在Storyboard中,当选择UIViewController时,可以直接在属性面板中切换属性。

In Storyboard, you can switch the property directly in the property panel when the UIViewController is selected.

如果你使用xib,只需这样设置:

If you use xib, just set it like this:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self.automaticallyAdjustsScrollViewInsets = NO;
}

注意:这是从iOS7开始,仍然在iOS8中。

Note: this is right since iOS7 and still in iOS8.

这篇关于iOS7 UIScrollView在状态栏下方显示偏移量内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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