views:

227

answers:

1

Hey Guys,

My app has some table cells that vary in height. The cells can also have a UIButton set to be a detail disclosure button (round, blue with arrow) as their accessory view.

Depending on the height of the cell, the accessory view is positioned differently. At first I thought it was my layout code for my cell that was causing the problem, so I set up a quick independent test that uses vanilla UITableCells to remove the possibility that it could be my fault.

I set up a view in interface builder, and just added a view table cells to the view, set their heights to different values and then added a detail disclosure button to each. Nothing more, nothing less.

This is what I see:

UITableViewCells with different x values

I added the size guides (thanks to Xscope) so you can see the difference in the accessory view x positions.

The heights are:

  • top 37px
  • mid 68px
  • bottom 44px (default, untouched height)

If I increase the height any heigher than 68px the accessory view doesn't move any further to the left.

Is this a bug? Is there any way I can prevent this from happening?

Here's the test project to reproduce.

TableViewCellHeightsTest.zip

+1  A: 

I got the same problem when I downloaded your file. Instead of setting the detail disclosure buttons manually and assigning them to cells as outlets, delete all disclosure indicators and try setting them this way instead:

alt text

Mads Mobæk
Yes, I did notice that after you said you weren't seeing the issue. However, in my code the disclosure buttons are being created programatically and set as the cell's accessory view, so I was trying to replicate that in interface builder. I guess I overlooked the simplicity of just setting the cell's accessory type to detail disclosure and then setting it's action...
Jasarien
This is a very vexing problem. I have the same issue, setting all my cell code programmatically, and getting different positions for the indicators based on the cell height.
Michael