How to grey out a button to let the user know that it is currently disabled in iOS?

Thor

I'm currently developing a simple iOS app using Xcode and Swift. In my app, there is a button that some times is disabled/enabled, depending on something else the user have touched. But when I set "button.enabled = false", I also what the button to grey out, so that the user knows the button is currently disabled. How could this be done?

slashdot

Use following code for customizing button's title for disabled state. You can call it inside viewDidLoad:

button.setTitleColor(UIColor.grayColor(), forState: .Disabled)

If you would like to customize a background colour for the disabled button, use approach from this answer: How to change background color of UIButton when it's highlighted


Swift 5.3:

button.setTitleColor(.systemGray, for: .disabled)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

iOS 7 modal view makes buttons grey (disabled)

From Dev

How do I know if cellular access for my iOS app is disabled?

From Dev

How to find out the name of currently logged in user in ASP.NET?

From Dev

How to know if User disabled transparency in Settings -> Accessibility?

From Dev

How to let user know, an ImageView is clickable

From Dev

How to find out the currently logged-in user in Spring Boot?

From Dev

how to Grey out and disable a button after its been pressed once?

From Dev

How to test if navigationBar button is enabled/disabled in UI test on iOS?

From Dev

Grey out form button on touch start

From Dev

How to grey out label in Extjs

From Dev

How to grey out in html tables

From Dev

iOS: How to let UITableView draw its cells out of its bounds?

From Dev

How does a Python DBus session service know the user is logging out?

From Dev

Button disabled but not grayed out

From Dev

How to find out the name of currently logged in user in ASP.NET?

From Dev

how to know on which button user made click?

From Dev

How to make the background color grey when a dropdownlist is disabled in AngularJS

From Dev

How to highlight/grey-out Tabcontrol Tabpage

From Dev

How to let user know, an ImageView is clickable

From Dev

Grey out form button on touch start

From Dev

how to know which radio button is selected out of all options?

From Dev

How to Grey out a Div and set a time out

From Dev

How to grey out label in Extjs

From Dev

Unable to figure out how toggle button is getting disabled

From Dev

Custom message to "This account is currently not available" when user login is disabled

From Dev

How to enable a currently disabled button in Swift

From Dev

How to remove the grey out of BootstrapDialog

From Dev

How to access a disabled button

From Dev

How to let the user decide a font for a button?

Related Related

  1. 1

    iOS 7 modal view makes buttons grey (disabled)

  2. 2

    How do I know if cellular access for my iOS app is disabled?

  3. 3

    How to find out the name of currently logged in user in ASP.NET?

  4. 4

    How to know if User disabled transparency in Settings -> Accessibility?

  5. 5

    How to let user know, an ImageView is clickable

  6. 6

    How to find out the currently logged-in user in Spring Boot?

  7. 7

    how to Grey out and disable a button after its been pressed once?

  8. 8

    How to test if navigationBar button is enabled/disabled in UI test on iOS?

  9. 9

    Grey out form button on touch start

  10. 10

    How to grey out label in Extjs

  11. 11

    How to grey out in html tables

  12. 12

    iOS: How to let UITableView draw its cells out of its bounds?

  13. 13

    How does a Python DBus session service know the user is logging out?

  14. 14

    Button disabled but not grayed out

  15. 15

    How to find out the name of currently logged in user in ASP.NET?

  16. 16

    how to know on which button user made click?

  17. 17

    How to make the background color grey when a dropdownlist is disabled in AngularJS

  18. 18

    How to highlight/grey-out Tabcontrol Tabpage

  19. 19

    How to let user know, an ImageView is clickable

  20. 20

    Grey out form button on touch start

  21. 21

    how to know which radio button is selected out of all options?

  22. 22

    How to Grey out a Div and set a time out

  23. 23

    How to grey out label in Extjs

  24. 24

    Unable to figure out how toggle button is getting disabled

  25. 25

    Custom message to "This account is currently not available" when user login is disabled

  26. 26

    How to enable a currently disabled button in Swift

  27. 27

    How to remove the grey out of BootstrapDialog

  28. 28

    How to access a disabled button

  29. 29

    How to let the user decide a font for a button?

HotTag

Archive