Created
January 7, 2019 19:57
-
-
Save yunustek/48f5d67996b363c64957158064764b76 to your computer and use it in GitHub Desktop.
iOS Accesibility
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
func configureAccessibility(_ account: Account) { | |
photoButton.isAccessibilityElement = true | |
usernameLabel.isAccessibilityElement = true | |
pointButton.isAccessibilityElement = true | |
photoButton.accessibilityTraits = .button | |
usernameLabel.accessibilityTraits = .staticText | |
pointButton.accessibilityTraits = .button | |
//Point Button | |
//Label Value - Accessibility Value - Hint Value: Bu okunacak sıradır. | |
pointButton.accessibilityLabel = "Puan" | |
switch account.pointCount { | |
case 0: | |
pointButton.accessibilityValue = "Bulunmuyor" | |
default: | |
pointButton.accessibilityValue = "\(account.pointCount) puan var" | |
} | |
pointButton.accessibilityHint = "Puanlar hakkında detayları açıklar" | |
//Username Label | |
usernameLabel.accessibilityLabel = "Adın" | |
usernameLabel.accessibilityValue = account.username | |
usernameLabel.accessibilityHint = "Adın hakkında bilgiyi açıklar" | |
//Photo Button | |
photoButton.accessibilityLabel = "Fotoğraf" | |
switch account.photo { | |
case nil: | |
photoButton.accessibilityValue = "Bulunmuyor" | |
default: | |
photoButton.accessibilityValue = "Burada bir fotoğrafın bulunuyor" | |
} | |
photoButton.accessibilityHint = "Fotoğraf değiştirmeyi sağlar" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment