I have a custom tableviewcell with the standard disclosure indicator positioned in the centre vertically by default. How can I move this standard disclosure indicator vertically like in the iOS mail app?
You can adjust the position of the default accessory by subclassing your cell and finding the UIButton in the cell's subviews (which represents the indicator) and holding a reference to it. You can then simply update the frame of the accessoryButton in layoutSubviews or wherever you choose like so:
class CellSubclass: UITableViewCell {
var accessoryButton: UIButton?
override func awakeFromNib() {
super.awakeFromNib()
accessoryType = .DisclosureIndicator
accessoryButton = subviews.flatMap { $0 as? UIButton }.first
}
override func layoutSubviews() {
super.layoutSubviews()
accessoryButton?.frame.origin.y = 8
}
}
You can not move standard disclosure indicator vertically.
If you want to achieve this functionality, then you need to use your custom cell and use image of disclosure indicator and then you can set this image with button on where ever you want to place.
Or you can use view also as a accessory indicator and add as a subview of UITableViewCell
[cell.contentView addSubview:aView];
You can read more over here disclosure indicator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With