Skip to content

djbrooks111/TimePicker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Android Kitkat's TimePicker version for iOS

How To Use

  1. Import CustomTimePicker.h

  2. Set CustomTimePickerDelegate

  3. Implement the Delegate's dismiss method

  4. Save/Use the clock's values

ClassUsingTimePicker.h

#import "CustomTimePicker.h"
@interface ClassUsingTimePicker.h : UIViewController <CustomTimePickerDelegate> {
  IBOutlet UIButton *clockButton;
}

@property (nonatomic, strong) CustomTimePicker *clockView;

-(IBAction)clockButtonPressed:(id)sender;

@end

ClassUsingTimePicker.m

@implementation ClassUsingTimePicker

@synthesize clockView;

// Called when clockButton is pressed
-(IBAction)clockButtonPressed:(id)sender {
  clockView = [[CustomTimePicker alloc] initWithView:self.view withDarkTheme:false];
  clockView.delegate = self;
  [self.view addSubview:clockView];
}

// Delegate method called when clockView is dismissed
-(void)dismissClockViewWithHours:(NSString *)hours andMinutes:(NSString *)minutes andTimeMode:(NSString *)timeMode {
  NSLog(@"%@:%@ %@", hours, minutes, timeMode);
}

@end

What the Delegate returns

Implementation of delegate will return 3 strings :

  1. Hour String.
  2. Minute String.
  3. AM/PM String.

About

This is customised component for time selection for iPhone.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%