Adding Date Picker to view programmatically?
datepicker, iphone
Solution
It's very easy man.You can do it in seconds.
Just use the these methods in your.m file...all is ready
- (void)viewDidLoad {
CGRect pickerFrame = CGRectMake(0,250,0,0);
UIDatePicker *myPicker = [[UIDatePicker alloc] initWithFrame:pickerFrame];
[myPicker addTarget:self action:@selector(pickerChanged:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:myPicker];
[myPicker release];
}
- (void)pickerChanged:(id)sender
{
NSLog(@"value: %@",[sender date]);
}
Problem
Can someone illustrate (or point me to a good tutorial) on how to add a Date Picker to a view programmatically (i.e., without using the interface editor)?