[英]XCode 7.1.1 TableViewCell's Content View narrower than cell
Since upgrading an older Swift 1.1 (I think) project to the latest XCode and swift syntax, the Storyboard seems all messed up. 自从将较旧的Swift 1.1(我认为)项目升级到最新的XCode和swift语法以来,情节提要似乎一团糟。 The most glaring bug that I can't seem to solve is in a UITableView. 我似乎无法解决的最明显的错误是在UITableView中。
I have a UITableViewCell with a standard Content View inside, which XCode wants to be 810px wide, as opposed to the cell, which is 1024px wide. 我有一个带有标准Content View的UITableViewCell,它的XCode希望为810px宽,而不是单元格为1024px宽。
I've tried to fix this by opening the storyboard in source code mode and changing the 810 to 1024, but the changed value reverts to 810 when reopening the storyboard back in the default "graphics" mode. 我试图通过在源代码模式下打开情节提要并将810更改为1024来解决此问题,但是当以默认的“图形”模式重新打开情节提要时,更改后的值恢复为810。
...
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="8zh-sj-0jQ" id="fLL-9o-aQq">
<rect key="frame" x="0.0" y="0.0" width="810" height="43"/>
...
Any idea how to solve this? 任何想法如何解决这个问题?
Whatever you do to UITableViewCell 's content view, is not gonna matter really as it'll be set right before getting drawn on screen by the UITableView . 不管您对UITableViewCell的内容视图做什么,都没有关系,因为它会在由UITableView绘制在屏幕上之前进行设置。 My suggestion is to reset all layout settings for contentView and use layout constraints for the views inside the contentView . 我的建议是重置内容查看所有的布局设置和使用布局约束的内容查看里面的意见。 If it still doesn't occupy the entire space, check and see if your UITableView is wide enough. 如果仍然没有占据整个空间,请检查您的UITableView是否足够宽。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.