Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. The most glaring bug that I can't seem to solve is in a 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.

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.

...
<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?

like image 539
Rhuantavan Avatar asked Dec 02 '15 08:12

Rhuantavan


1 Answers

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. 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.

like image 97
Peyman Avatar answered Oct 16 '22 23:10

Peyman