It appears to be quite difficult to change the way a UIDatePicker
appears.
The example you provided, in my opinion, is a sophisticated customization of a simple UIPickerView
with two columns and probably a simulated infinite scroll (as Apple does in the date picker, and it's quite simple to realize).
You can change little of the UIDatePicker
through the UIAppearance
proxy, as seen in this example:
UIDatePicker *picker = [UIDatePicker appearance];
picker.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:0.3];
UIView *view;
view = [UIView appearanceWhenContainedIn:[UITableView class], [UIDatePicker class], nil];
view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
UILabel *label = [UILabel appearanceWhenContainedIn:[UITableView class], [UIDatePicker class], nil];
label.font = [UIFont systemFontOfSize:[UIFont systemFontSize]];
label.textColor = [UIColor blueColor];
Using this piece of code at the start of the application (just try it) you can change the aspect of only a couple of the main components of the date picker.
Labels are impossible to customize (and this test code proves it); apparently they are changed in aspect every time you rotate a column, since they are put inside a custom UITableView
controller.
To fully change these appearances you should probably work with private APIs from Apple, that will eventually result in your app being rejected.
If you just need a custom hour-minute picker (as shown in your screenshot), the full customization of appearance is reachable only extending the UIPickerView
class or assigning an appropriate delegate to a UIPickerView
instance.
Through the
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view;
method on the delegate you can make the single element of the picker view appear the way you want. Then you will have to appropriately handle the data source to make the two components of the picker virtually infinite.