UIDatePicker 添加到 UIActionSheet 上

简单的UIDatePicker     UIActionSheet 使用

 

datePicker1 =[[UIDatePicker alloc]initWithFrame:CGRectMake(0, 33, 320, 216)];
    datePicker1.timeZone=[NSTimeZone defaultTimeZone];
    datePicker1.datePickerMode=UIDatePickerModeDate;
    datePicker1.date=[NSDate date];
    [datePicker1 addTarget:self
                    action:@selector(valueChanged)
          forControlEvents:UIControlEventValueChanged];
    NSString * title=nil;
    NSString * title1=nil;
    if (oneOrTwo == 2) {
        title=@"请选择起始时间";
        title1=@"Next";
    }else if(oneOrTwo == 3){
        title=@"请选择截至时间";
        title1=@"OK";
    }
    UIActionSheet * actionSheet=
    [[UIActionSheet alloc]initWithTitle:title
                               delegate:self
                      cancelButtonTitle:title1
                 destructiveButtonTitle:@"cancel"
                      otherButtonTitles:@"1",@"2",@"3",@"Cancel", nil];
    [actionSheet setBounds: CGRectMake(0,0, 320, 400)];
    //    datePicker1.hidden=YES;
    [actionSheet addSubview:datePicker1];
    [actionSheet showInView:self.view];
    [actionSheet release];
    [datePicker1 release];

你可能感兴趣的:(Date,action)