Search code examples
iphoneobjective-cios4uitableview

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,


Solution

  • 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