Ios UITableView位于选项卡栏下
我有一个自定义UITableView,每个单元格的自定义单元格高度为70px 我还有一个49px的UITabBar,但它隐藏了tableView 我尝试将这一行添加到TableView awakeFromNib方法中,但没有成功:Ios UITableView位于选项卡栏下,ios,objective-c,swift,uitableview,cocoa-touch,Ios,Objective C,Swift,Uitableview,Cocoa Touch,我有一个自定义UITableView,每个单元格的自定义单元格高度为70px 我还有一个49px的UITabBar,但它隐藏了tableView 我尝试将这一行添加到TableView awakeFromNib方法中,但没有成功: self.commentsTableView.contentInset = UIEdgeInsetsMake(0, 0, 49, 0) 你知道我该怎么解决这个问题吗 谢谢 我不知道你到底做了什么,但试着这样做: self.edgesForExtendedLayout
self.commentsTableView.contentInset = UIEdgeInsetsMake(0, 0, 49, 0)
你知道我该怎么解决这个问题吗
谢谢 我不知道你到底做了什么,但试着这样做:
self.edgesForExtendedLayout = UIRectEdgeAll;
self.tableview.contentInset = UIEdgeInsetsMake(0.0f, 0.0f, CGRectGetHeight(self.tabBarController.tabBar.frame), 0.0f);
我希望,这会奏效。我不知道你到底做了什么,但试着这样做:
self.edgesForExtendedLayout = UIRectEdgeAll;
self.tableview.contentInset = UIEdgeInsetsMake(0.0f, 0.0f, CGRectGetHeight(self.tabBarController.tabBar.frame), 0.0f);
我希望这能起作用。尝试对tableView和TabBar使用约束,如:
尝试对tableView和TabBar使用约束,如:
在斯威夫特3中,这为我带来了成功
if let tabBarController = tabBarController {
self.tableView.contentInset = UIEdgeInsetsMake(0.0, 0.0, tabBarController.tabBar.frame.height, 0.0);
}
在斯威夫特3中,这为我带来了成功
if let tabBarController = tabBarController {
self.tableView.contentInset = UIEdgeInsetsMake(0.0, 0.0, tabBarController.tabBar.frame.height, 0.0);
}
试试这个
self.commentsTableView.contentInset = UIEdgeInsetsMake(49, 0, 0, 0)
self.commentsTableView.setContentOffset(CGPoint.init(x: 0, y: -49), animated: false)
试试这个
self.commentsTableView.contentInset = UIEdgeInsetsMake(49, 0, 0, 0)
self.commentsTableView.setContentOffset(CGPoint.init(x: 0, y: -49), animated: false)
您应该使用以下代码配置相应的视图控制器以删除边缘,并将其默认值扩展为UIRectEdgeAll
edgesForExtendedLayout = []
您应该使用以下代码配置相应的视图控制器以删除边缘,并将其默认值扩展为UIRectEdgeAll
edgesForExtendedLayout = []
在导航控制器中处理没有半透明条的表视图时,我遇到了这个问题。我执行了与以下类似的设置:
override func viewDidLoad() {
super.viewDidLoad()
// Without this there is some extra fast inertia when slowly
// scrolling to the top.
extendedLayoutIncludesOpaqueBars = true
// Don't extend the tableview past the bottom bar, though.
// If we do then a tab bar or bottom nav bar will block
// content.
edgesForExtendedLayout = [.top, .left, .right]
}
然而,我后来发现在更高层次的故事板中有几个复选框未选中。具体而言,这两项:
选中这两个框就不必关心视图控制器中的内容插入和布局扩展行为了在导航控制器中处理没有半透明条的表视图时,我遇到了这个问题。我执行了与以下类似的设置:
override func viewDidLoad() {
super.viewDidLoad()
// Without this there is some extra fast inertia when slowly
// scrolling to the top.
extendedLayoutIncludesOpaqueBars = true
// Don't extend the tableview past the bottom bar, though.
// If we do then a tab bar or bottom nav bar will block
// content.
edgesForExtendedLayout = [.top, .left, .right]
}
然而,我后来发现在更高层次的故事板中有几个复选框未选中。具体而言,这两项:
选中这两个框,就不必关心该视图控制器中的内容插入和布局扩展行为了如果在上一个视图控制器中更改了self.hidesBottomBarWhenPushed=true,那么请确保将其更改为self.hidesBottomBarWhenPushed=false inside override funct preparefor segue:UIStoryboardSegue,发送者:有吗?{}如果在上一个视图控制器中更改了self.hidesBottomBarWhenPushed=true,那么请确保在覆盖函数中将其更改为self.hidesBottomBarWhenPushed=false,用于segue:UIStoryboardSegue,sender:Any?{}你在使用情节提要吗?@VishalSonawane不,我在使用NIB/XIB文件你在使用自动布局或自动调整大小?@VishalSonawane是的,我当然使用constraints@BhadreshMulsaniya我没有对此做任何更改,所以我想我使用的是自动布局,因为这是默认选项。你使用的是故事板吗?@VishalSonawane不,我使用的是NIB/XIB文件您使用的是自动布局还是自动调整大小?@VishalSonawane是的,我当然使用constraints@BhadreshMulsaniya我没有对此做任何更改,所以我想我使用的是自动布局,因为这是默认选项你保存了我的一天,兄弟。非常感谢你。这是正确的答案,你救了我,兄弟。非常感谢你。这是正确的答案。