Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set position of uitableviewcellaccessory

By default the UITalbeViewCellAccessory's position is in the middle of the cell off to the right. I want to shift it 29 pixels on the Y axis (move it down 29 pixels). How can i do this? I tried setting the accessoryView's frame but that didn't work.

Thanks,

like image 679
odyth Avatar asked Dec 31 '25 14:12

odyth


1 Answers

Set the accessoryView initial frame is affectless, it is changed any time that the cell does a layout, you need to:

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.accessoryView.center = CGPointMake($yourX, $yourY);
}

This is a simple way to set a custom position for the accessoryView that is persisted in any cell status

like image 168
Kappe Avatar answered Jan 03 '26 13:01

Kappe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!