简体   繁体   English

在Swift中的UITableView中重叠节名称

[英]Overlapping section names in UITableView in Swift

I have a container in my UIControlView . 我的UIControlView有一个容器。

This is the relevant part of Storyboard . 这是Storyboard的相关部分。 The starting view is a TabBarController , that has a TableView (named _Constructed_ ) in its second tab. 起始视图是一个TabBarController ,在其第二个选项卡中具有TableView (名为_Constructed_ )。 The Table is embedded in NavigationController . 该表嵌入在NavigationController When user taps at a cell in this Table, he's taken (with a Show segue) to a GameDetailViewController , that has two containers - the upper one is PageView and the bottom one is TableView . 当用户点击此表中的某个单元格时,他被带了一个Show GameDetailViewController到一个GameDetailViewController ,其中有两个容器-顶部是PageView ,底部是TableView 故事板

The issue appears in this TableView . 问题出现在此TableView Even though I have constraints set up (width is the same superview's, height is from bottom tabBar to the upper Container, which has fixed height and width), both upper and bottom sides are kinda pushed in a way. 即使我设置了约束(宽度是相同的父视图的高度,高度是从底部的tabBar到上部的Container,高度和宽度都固定),但上部和下部都以某种方式被推动。

重叠部分

I managed to fix this issue by merely restarting XCode and reopening the project a few times. 我设法通过重新启动XCode并重新打开项目几次来解决此问题。 Maybe it's some kind of a bug, I haven't changed my code in any way and it just started working. 也许这是一个错误,我没有以任何方式更改我的代码,它才开始起作用。

I suggest you need to pay attention to the Size Classes you used. 我建议您需要注意所使用的大小类 When you reopen your Xcode , it directs you back AnyW, AnyH . 当您重新打开Xcode时 ,它将引导您返回AnyW, AnyH It might change the fixed size under some scenario. 在某些情况下,它可能会更改固定大小。 Also, make sure that you are testing using the same simulator. 另外,请确保您正在使用同一模拟器进行测试。

I had the same problem. 我有同样的问题。

Im not sure, but you can replace the header from the tableView and it would work right. 林不知道,但是您可以从tableView替换标头,它将正常工作。

tableView.tableHeaderView = myPageView

If it's not the case you should manage the contentInset and contentOffset by yourself for your header and for the list. 如果不是这种情况,则应该由您自己管理标题和列表的contentInset和contentOffset。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM