Reputation: 1024
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;
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
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
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