I'm new to iOS and working this DatePicker for the first time. I'm trying to show a date picker inside a UIActionSheet. I got this code from other StackOver flow topics
- (void)showDatePicker:(UITapGestureRecognizer *)recognizer {
NSLog(@"label touched");
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Date Picker"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"OK",nil];
// Add the picker
UIDatePicker *pickerView = [[UIDatePicker alloc] init];
pickerView.datePickerMode = UIDatePickerModeTime;
[menu addSubview:pickerView];
[menu showInView:self.view];
CGRect menuRect = menu.frame;
CGFloat orgHeight = menuRect.size.height;
menuRect.origin.y -= 214; //height of picker
menuRect.size.height = orgHeight+214;
menu.frame = menuRect;
CGRect pickerRect = pickerView.frame;
pickerRect.origin.y = orgHeight;
pickerView.frame = pickerRect;
//[pickerView release];
//[menu release];
}
but the DatePicker is not showing. This is what I get.
What am I doing wrong here?