Please see below 3 table view cells in the same app, the height of the cell is 54 in interface builder, the border is created using CAShapeLayer in code with a height of 44. Since I switched from xcode5 to xcode6 during the project development, so part of the uitableviewcell is created in xcode5 and part in xcode6, and there are cells that are created in xcode5 and later changed in xcode6.
image1. created using xcode5, the desired style
image2. created using xcode6 beta6, displayed in iOS8 simulator, disclosure indicator
misplaced, and text are offseted
image3. the same cell of image2 using xcode6 beta6, but running in iOS7.1 device, disclosure indicator
misplaced
I compared all the settings of the uitableviewcell in interface builder, and find NO differences.
And I compared the source file of xxx.storyboard, and finally got the different point:
case1: the 'tableViewCell' tag, the xcode5 version is:
<tableViewCell contentMode="scaleToFill" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="xxCell" rowHeight="54" id="far-Kn-fRP" customClass="xxCell">
<rect key="frame" x="0.0" y="119" width="320" height="54"/>
case2: the 'tableViewCell' tag, the xcode6 beta6 version is below, NOTICE, the < rect key="frame" ...> is missing when creating a new uitableviewcell
<tableViewCell contentMode="scaleToFill" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="xxxCell" rowHeight="54" id="eav-sl-Yrd" customClass="xxxCell">
case3: the scenario in image2 and image3 is a uitableviewcell created in xcode5 with default height of 44, and modified in xcode6 beta6 to change the height to 54, and the source is:
<tableViewCell contentMode="scaleToFill" selectionStyle="none" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="xxxCell" rowHeight="54" id="eav-sl-Yrd" customClass="xxxCell">
<rect key="frame" x="0.0" y="119" width="320" height="44"/>
As a conclusion, it seems that xcode6 beta6 is not handling the < rect key="frame" ...> tag in the .storyboard file, and will cause misplace of uitableviewcell.
Added: In all of the above scenarios, the code has implemented heightForRowAtIndexPath
, and returned 54.
My Questions are:
I didn't find how to place
disclosure indicator
at the same place as xcode5Is the missing of < rect key="frame" ...> a bug or replaced by other tags in xcode6? Possible related to the cell auto sizing feature in iOS8?
Is there other solutions to make uitableviewcell right? I'm currently manually modifying .storyboard file to add < rect key="frame" ...> tag for each newly created uitableviewcell using xcode6 beta6, and it is error prone.
Thanks.
contentView
? Are there constraints? Are those constraints connected to the cell or to thecontentView
(that's very important)? Also, are you aware of the new iOS 8 automatic row height feature? It might be affecting the vertical layout of the cell. – SpangheightForRowAtIndexPath
for all uitableview already. And the examples in my questions return 54 in funciton:heightForRowAtIndexPath
– Alexis