UITableViewController的顶部边距 [英] Top margin on UITableViewController

查看:240
本文介绍了UITableViewController的顶部边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TabBarController,其中的一个选项卡包含一个子视图是一个navigationController。我然后加载到导航控制器的视图,它继承的形式UITableViewController。

I have a TabBarController, one of the tabs of which contains a sub view which is a navigationController. I am then loading into the navigation controller a view which inherits form UITableViewController.

我的问题是thta由于某种原因表视图开始behing导航控制器,而不是顶部屏幕,但大约在导航栏的一半,因此在表视图中的第一个单元格的顶部被切断。

My problem is thta for some reason the table view starts behing the navigation controller, not the top of the screen but about half way down the navigation bar, hence the top of the first cell in the table view is cut off.

任何人都可以建议如何移动UITableViewController向下?

Can anyone suggest how to move the UITableViewController down?

推荐答案

以编程方式修复:

   - (void)viewDidLoad {
       UIEdgeInsets inset = UIEdgeInsetsMake(20, 0, 0, 0);
       self.tableView.contentInset = inset;
   }

这篇关于UITableViewController的顶部边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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