ericteubert
ericteubert

Reputation: 4591

How do I align static "Right Detail" UITableViewCell contents with images properly?

I am using the storyboard, static cells and the "Right Detail" cell style. My issue looks like the following in both Xcode and simulator (red lines added for guidance):

enter image description here

As you can see, the third row is off. It is shifted to the right by 1 point. Both image and label are misaligned. All images have a width of 24px and the size inspector shows this correctly. Attributes inspector settings for all three cells are identical, except the image.

What's wrong? Thanks!

Upvotes: 3

Views: 389

Answers (1)

Nick Lockwood
Nick Lockwood

Reputation: 40995

Seems like the most likely explanation is that your "X" graphic isn't centered correctly.

If you've checked that it is correctly centered in photoshop, is it possible that the version you've checked and the one you are seeing in the app are different images (e.g. because one is a the @2x retina version)?

A good test might be to fill the background of the image with a colour (e.g. red) so you can see the image boundary and prove for certain that the image itself is misaligned, not the image contents.

Upvotes: 2

Related Questions