UITableViewCell indentation centering imageView?
Does anyone know of any reason why indentation of a UITableViewCell
would center the cell's UIImageView
horizontally? In theory (and judging by the screenshots and apps I've seen in the past), the imageView should always align to the right, keeping a consistent开发者_开发问答 space to the two labels. In my case (screenshot below), it doesn't. This is a default UITableViewCell
with the UITableViewCellStyleSubtitle
style. Any clues? I've been looking at this for quite a while and can't seem to figure it out.
Update: apparently UITableViewCellStyleDefault
doesn't have this issue - imageView's are right-aligned with the (single) label. Why there is a difference between the two styles is beyond me.
(green/blue areas added to illustrate the issue)
How UITableViewCell draws its contentView is not how you would normally draw subviews in an UIView. It does not modify frame
property of imageView, textLabel and detailLabel. I guess it gets those views graphic references and dealing with custom drawing.
Which means, there is no control. Unfortunately I also have to say you need some customizations. But it would be enough just to have a custom content view, not to subclass the whole table view cell class.
精彩评论