Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent voice over (Accessibility) from announcing UITableViewCell as selected

When a UITableViewCell is selected, voice over announces "selected", I don't want voice over to say "selected". How can i achieve this ?

Things I have tried with no success:

  • Changed the cell accessibilityHint and accessibilityLabel
  • Changed the cell selectionStyle = UITableViewCellSelectionStyleNone
  • changed the cell accessibilityTraits = UIAccessibilityTraitButton

Question:

  • I don't want voice over to say "selected" when a cell is selected. How can i achieve this ?
like image 433
user1046037 Avatar asked Dec 03 '14 12:12

user1046037


1 Answers

I asked this as a code level support issue from Apple and got the following solution which works perfectly. Use a custom subclass of UITableViewCell where you override accessibilityTraits as in the following example:

class NoTraitCell: UITableViewCell {
    override var accessibilityTraits: UIAccessibilityTraits {
        get {
            return UIAccessibilityTraitNone
        }
        set {}
    }
}
like image 109
Melodius Avatar answered Sep 24 '22 11:09

Melodius