请检查代码
-(IBAction)showDateSheet{
dateSheet=[[UIActionSheet alloc]initWithTitle:@"Select Test Date" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:nil];
datePicker=[[UIDatePicker alloc]init];
[datePicker addTarget:self action:@selector(changeDateInLabel:) forControlEvents:UIControlEventValueChanged];
dateSheet.delegate=self;
//[dateSheet setFrame:CGRectMake(0, 117, 320, 383)];
datePicker.datePickerMode=UIDatePickerModeDate;
CGRect pickerRect=datePicker.bounds;
pickerRect.origin.y=-100;
datePicker.bounds=pickerRect;
[dateSheet addSubview:datePicker];
[dateSheet showInView:self.view];
[dateSheet setBounds:CGRectMake(0.0f, 0.0f, 320, 500)];
//[datePicker release];
//[dateSheet release];
}
通过使用上面的代码,我无法单击取消按钮,当我点击取消按钮时没有任何反应