0

取消区域在日期的顶部,选择器仍然有效,但隐藏在取消按钮下。

这段代码曾经可以工作,所以我猜测它与较新的操作系统有关吗?

我有一段时间不需要弄乱 iPhone 代码,现在发现日期选择器有问题。所以我在 XCode 上根本跟不上速度,而是试图蒙混过关,看看问题出在哪里。我想我最终会再次加快速度并找出问题所在,但如果有人能告诉我这是什么问题,那就太棒了。

-(void)willPresentActionSheet:(UIActionSheet *)actionSheet {

    switch ([actionSheet tag] ) {
        case 1://date

        {    
            NSDate *d;

            UIDatePicker *pickerView = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 50, 100, 116)];

            [pickerView setTag:100+[actionSheet  tag]];

            [pickerView setDatePickerMode:UIDatePickerModeDate];



            [actionSheet addSubview:pickerView];

            [pickerView release];

            NSArray *subViews = [actionSheet subviews];

            [[subViews objectAtIndex: SelectButtonIndex] setFrame:CGRectMake(20, 266, 280, 46)]; 
           [[subViews objectAtIndex:CancelButtonIndex] setFrame:CGRectMake(20, 317, 280, 46)];



        }

            break; 

    }


}



- (IBAction)btnDate:(id)sender {



    UIActionSheet *asheet = [[UIActionSheet alloc] 

                             initWithTitle:@"Pick the date" 
                             delegate:self
                             cancelButtonTitle:@"Cancel" 
                             destructiveButtonTitle:nil 
                             otherButtonTitles:@"Select"
                             , nil];

    [asheet setTag:1];
    [asheet showInView:[self.view superview]]; 

    [asheet setFrame:CGRectMake ( 0, 117, 320, 383)];
    [asheet release];

}
4

0 回答 0