MobileDev
MobileDev

Reputation: 1024

Action Sheet is not displaying properly in ipad mini

I am developing one application. In that application i want to present a action sheet with options.
I written the following code for the action sheet requirement.

UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:AALocalizedString(@"Capture Document", nil),AALocalizedString(@"Select Document", nil) ,AALocalizedString(@"Capture Photo", nil),AALocalizedString(@"Select Photo", nil),nil];      
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView:self.view];
actionSheet=nil;

only cancel button is displayed It is working fine in iphone and ipad devices i.e, iphone5,iphone5c,iphone5s,iphone4,iphone4s,ipod touch, ipad etc.
But it is not working in iPad Mini. only cancel button is displayed.

Upvotes: 0

Views: 379

Answers (2)

user1350842
user1350842

Reputation:

You used AALocalizedString method when setting the other button titles of Action Sheet. Ensure that the method will give the string or not. If it is not giving any string then action sheet is not displaying other buttons rather than cancel button. Or once try the below code.

    UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Capture Document",@"Select Document" ,@"Capture Photo",@"Select Photo",nil];      
    actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
    [actionSheet showInView:self.view];
    actionSheet=nil;

Upvotes: 1

user3493920
user3493920

Reputation: 1

May be help you,

UIAlertController *alertCV = [UIAlertController alertControllerWithTitle:@"Alert Title" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
        UIAlertAction *alertActn = [UIAlertAction actionWithTitle:@"Test1" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
            [alertCV dismissViewControllerAnimated:YES completion:nil];
        }];
        UIAlertAction *alertActn1 = [UIAlertAction actionWithTitle:@"Test2" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
            [alertCV dismissViewControllerAnimated:YES completion:nil];
        }];
        [alertCV addAction:alertActn];
        [alertCV addAction:alertActn1];
        [self presentViewController:alertCV animated:YES completion:nil];

Upvotes: 0

Related Questions