Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom UITableViewCell accessibility

How can you set the accessibility of subviews of UITableViewCells individually.
It should not be accessible as complete cell?

like image 850
SwapnilN Avatar asked Mar 17 '14 16:03

SwapnilN


1 Answers

Contributing to the answer of @ma11hew28, here is another way of doing that saves some lines of code,

Swift 5:

class ServiceTableViewCell: UITableViewCell {
    override func awakeFromNib() {
        super.awakeFromNib()
        self.selectionStyle = .none
        self.isAccessibilityElement = false //not allowing accessibility for the cell itself
        self.accessibilityElements = [mySubview1!, mySubview2!, mySubview3!] // but allowing accessibility in the cell's subviews
    }
}
like image 97
Mumtaz Hussain Avatar answered Oct 03 '22 21:10

Mumtaz Hussain