开发者

UITableViewCell with custom disclosure causes mis-alignment?

I hope someone reading this might be able to shed some light on this problem.

I have a plain UITableView containing custom UITableViewCells, each cell is a different height provided by tableView:heightForRowAtIndexPath: and the table does not scroll. The cells themselves are really containers for one or two UILabels nothing very special. Three of the cells show a custom disclosure when editing apart from that no disclosures are used for anything else. The custom disclosures are UIImageView's assigned to the cells editingAccessoryView with 28x29 images however the UIImageView size is set to 40x29 to give a better position using contentMode Left.

This should work fine but what happens is when the disclosures appear in edit mode they don't all share the same position - two might be the same x and t开发者_Go百科he third might be 5px different. This seems to be dependant on the height given to each cell, they basically move around. I can't see how they are associated but have found one set of heights that give the expected results of all three being in the same position. This isnt ideal but has been working fine till now - I have no choice but to change the heights and so the alignment is a big problem.

If I remove the custom disclosures then the standard disclosures work perfectly?

I've tried lot's of things, i.e.

  • removing the extra width on the UIImageView
  • reducing the size of the image
  • playing around with the cell heights - the disclosures just move around
  • replacing the UIImageView's with other controls - no difference

If you have any ideas why this might be I'd love to here them, thanks.


My guess is its because you are using content mode left in the UIImageView. Use content mode center.

The views get stretched in all directions when the height changes, but the image stays on the left edge of the view...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜