I try to add a date picker in action sheet , also give another button
It looks like the image
I can get the time when I roll the picker
But that small Done button not work...
I can't even to touch it.
This is my code ,not too much ...
I can't figure why the button not working ?
- (IBAction)selectDate:(id)sender{
menu = [[UIActionSheet alloc] initWithTitle:@"Select Date"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
[menu setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
startPickerView = [[UIDatePicker alloc] init];
startPickerView.datePickerMode = UIDatePickerModeTime;
[menu sendSubviewToBack:startPickerView];
[menu showInView:self.view];
[menu setBounds:CGRectMake(0,0,320,460)];
CGRect pickerRect = startPickerView.bounds;
pickerRect.origin.y = -60;
startPickerView.bounds = pickerRect;
[startPickerView addTarget:self action:@selector(timeChange:) forControlEvents:UIControlEventValueChanged];
UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Done"]];
closeButton.momentary = YES;
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor blackColor];
[closeButton addTarget:self action:@selector(dismissActionSheet:) forControlEvents:UIControlEventTouchUpInside];
[menu addSubview:startPickerView];
[menu addSubview:closeButton];
[closeButton release];
[menu release];
[startPickerView release];
}
Many thanks for any reply~
Webber