开发者

UIActionSheet height on iPad

开发者 https://www.devze.com 2023-02-15 10:43 出处:网络
I have some troubles with UIActionsheet on iPad actionally his height is not moving wherever the changes are, so I can\'t see the Done button

I have some troubles with UIActionsheet on iPad actionally his height is not moving wherever the changes are, so I can't see the Done button

and here is my code :

-(void) showActionSheet{

UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"" 
                                                  delegate:self
                                         cancelButtonTitle:@"cancel"
                                    destructiveButtonTitle:@"Done"
                                         otherButtonTitles:nil];

Reports = [[NSMutableArray alloc] init];
    //Add the picker
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
    datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 80, 0, 0)];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(5, 20, 400, 420)];
datePicker.datePickerMode = UIDatePickerModeDate;
[menu addSubview:datePicker];
[menu showFromRect:[self frame] inView:self animated:YES];        
if (UI_USER_INTERFAC开发者_JAVA技巧E_IDIOM() == UIUserInterfaceIdiomPhone)
    [menu setBounds:CGRectMake(0,0,480, 260)];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
    [menu setBounds:CGRectMake(-20,10,480, 400)];
menu.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleTopMargin
|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleBottomMargin;
[menu release];


}


To see Done Button you can do one thing as I do always

UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"" 
                                              delegate:self
                                     cancelButtonTitle:@"cancel"
                                     destructiveButtonTitle:@""
                                     otherButtonTitles:@"",@"",@"Done",nil,nil];

I think this will work.

I know this is not a good way but you can do this for now.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号