Reputation: 1503
In the native Mail app, the To: field has a ContactAdd UIButton on the right in the accessoryView position, but it is aligned to the bottom of the cell (which you can see as the cell grows in height). Is it possible to mimic this using the accessoryView property? As far as I can tell, accessoryViews always align in the middle.
Upvotes: 3
Views: 3886
Reputation: 530
I found that you can subclass UITableViewCell, override layoutSubviews, and in that method, get the accessoryView and adjust its frame as desired.
Upvotes: 8
Reputation: 506
In my app, I found a partly-working solution with the following code:
UIImage *accessoryImage = [UIImage imageNamed:@"accessory_disclosure_bottom.png"];
UIImageView *accImageView = [[UIImageView alloc] initWithImage:accessoryImage];
[accImageView setFrame:CGRectMake(0, 10, 14, 28)];
accImageView.backgroundColor = [UIColor greenColor];
accImageView.userInteractionEnabled = YES;
cell.accessoryView = accImageView;
I got the image from http://m.tech-recipes.com/rx/UITV_accessory_disclosure.png, cut away the bottom padding and made the background transparent in my graphics program. It has the full accessor functionality when selecting the row, however the image is not colored blue when selecting, which is really annoying (it seems to ignore the background transparency altogether).
Upvotes: 1