Created
November 1, 2017 17:48
-
-
Save KaneCheshire/114017274605c6d30171a66a2bfa7a13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomCell: UICollectionViewCell { | |
@IBOutlet private var contentView: UIView! // Subview of `self` | |
@IBOutlet private var titleLabel: UIView! // Subview of `contentView` | |
@IBOutlet private var subtitleLabel: UIView! // Subview of `contentView` | |
@IBOutlet private var actionLabel: UIView! // Subview of `contentView` | |
private func setupAccessibility() { | |
contentView.isAccessibilityElement = true | |
let contentViewAccessibilityLabel = (titleLabel.text ?? "") + ", " + (subtitleLabel.text ?? "") | |
contentView.accessibilityLabel = contentViewAccessibilityLabel | |
actionLabel.isAccessibilityElement = true | |
actionLabel.accessibilityTraits = UIAccessibilityTraitButton | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment