Skip to content

UIDatePicker does not indicate whether it is disabled. This Objective-C category provides a method to visually disable a UIDatePicker.

License

Notifications You must be signed in to change notification settings

jhogervorst/VisuallyDisabledDatePicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VisuallyDisabledDatePicker

UIDatePicker does not indicate whether it is disabled. This Objective-C category provides a method to visually disable a UIDatePicker.

Example

Enabled and disabled UIDatePicker

Usage

  1. Add UIDatePicker+VisuallyDisabled.h and UIDatePicker+VisuallyDisabled.m to your project.
  2. Place #import "UIDatePicker+VisuallyDisabled.h" in top of the files where you'd like to disable a UIDatePicker.
  3. Call [aDatePicker visuallySetEnabled:NO] to disable a UIDatePicker. Replace NO with YES to enable it afterwards.

Methods

Only one method is available:

- (void)visuallySetEnabled:(BOOL)enabled

When this method is called, the UIDatePicker is enabled or disabled and the alpha property of the relevant subviews is changed, to visually show whether the control is enabled or disabled. This method should be used instead of the default setEnabled: method.

Compatibility

The code requires ARC. It has been tested in the iOS Simulator with iOS versions 5.0, 5.1, 6.0 and 6.1, both for iPhone and iPad.

Because the appearance of standard iOS UI elements is changed, Apple might reject apps using this code. Usage of this code is therefore at your own risk.

License

The code is licensed under MIT license. See LICENSE.txt for details.

About

UIDatePicker does not indicate whether it is disabled. This Objective-C category provides a method to visually disable a UIDatePicker.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published