Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在TableViewController上向TableView添加约束?_Ios_Swift_Uitableview_Constraints - Fatal编程技术网

Ios 如何在TableViewController上向TableView添加约束?

Ios 如何在TableViewController上向TableView添加约束?,ios,swift,uitableview,constraints,Ios,Swift,Uitableview,Constraints,我有TabBar,SearchController和TableView 为了解决黑屏问题,我在TableViewController中添加了以下字符串,将SearchController置于其自身: self.definesPresentationContext = true 但是,我收到了下一个问题-在我移动到下一个控制器并返回到TableViewController之后,该表被放置在导航栏下方 我怎样才能解决这个问题 选择您的viewcontroller并取消选中顶部栏下的复选框,我认为这

我有
TabBar
SearchController
TableView

为了解决黑屏问题,我在TableViewController中添加了以下字符串,将
SearchController
置于其自身:

self.definesPresentationContext = true
但是,我收到了下一个问题-在我移动到下一个控制器并返回到TableViewController之后,该表被放置在导航栏下方

我怎样才能解决这个问题


选择您的viewcontroller并取消选中顶部栏下的复选框,我认为这对您有帮助


选择您的ViewController,然后在顶部栏下选择“无”

您需要更新ViewController中的代码

override func viewWillAppear(_ animated: Bool) {
    self.navigationController?.isNavigationBarHidden=true
}

您可以在tableviewController
viewDidLoad
方法中尝试此操作:

yourTableView.contentInset = UIEdgeInsets(top: 50, left: 0, bottom: 0, right: 0)

这看起来像是我曾经遇到的contentOffset问题。你能试试这个吗?是的,现在表格没有放在导航栏下,但是我需要导航栏。谢谢你的回答。不幸的是,这对我不起作用。谢谢你的回答,这是工作!如何仅在从prev viewController转换后执行此操作。我试着用放松阶段的准备方法来做,但没用。你对此有什么想法吗?@IliaFedorov既然你原来的问题已经解决了,请再问一个问题,我会帮你解决新问题的。谢谢。这是我的新问题: