我正在實施UIDATEPICKER。問題是,當我點擊按鈕,警報片出現,日期選擇器被添加爲子視圖,但我想要兩個按鈕,Datepicker和警報單中的問題
1 - 取消2-做
我該怎麼辦?
UIActionSheet * aac = [[UIActionSheet alloc] initWithTitle:@「多少?」 代表:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];
aac.actionSheetStyle = UIActionSheetStyleBlackOpaque;
sheet = aac;
UIDatePicker *theDatePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0.0, 44.0, 0.0, 0.0)];
if(IsDateSelected==YES)
{
theDatePicker.datePickerMode = UIDatePickerModeDate;
theDatePicker.maximumDate=[NSDate date];
}else {
theDatePicker.datePickerMode = UIDatePickerModeTime;
}
self.dtpicker = theDatePicker;
[theDatePicker release];
[dtpicker addTarget:self action:@selector(dateChanged) forControlEvents:UIControlEventValueChanged];
pickerDateToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
pickerDateToolbar.barStyle = UIBarStyleBlackOpaque;
[pickerDateToolbar sizeToFit];
NSMutableArray *barItems = [[NSMutableArray alloc] init];
UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:nil];
[barItems addObject:flexSpace];
UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(DatePickerCancelClick)];
[barItems addObject:cancelBtn];
//// 它亙古不變的..我想這項工作....
我會做什麼?
嗨, 據我理解你的問題,請嘗試ñ提出使用具有一定的延遲和持續時間的UIView動畫效果的日期選擇器,同樣的邏輯也適用於工具欄,使確定它們同時出現......讓我知道我是否理解正確。 謝謝 – Gina 2011-02-14 18:21:23