【问题标题】:Action Sheet is not displaying properly in ipad mini操作表在 ipad mini 中无法正确显示
【发布时间】:2014-09-21 20:11:46
【问题描述】:

我正在开发一个应用程序。在那个应用程序中,我想展示一个带有选项的操作表。
我为操作表要求编写了以下代码。

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;

它在 iphone 和 ipad 设备(即 iphone5、iphone5c、iphone5s、iphone4、iphone4s、ipod touch、ipad 等)中运行良好。
但它不适用于 iPad Mini。只显示取消按钮。

【问题讨论】:

  • Popover 适用于 iPad mini。
  • 我的应用程序不是通用应用程序。我正在尝试呈现一个弹出框,但它给了我一个错误,例如弹出框仅适用于 ipad。
  • iPad mini 和 iPad 是完全一样的设备。适用于 iPad 的任何东西也适用于 iPad Mini。
  • iPad 和 iPad mini 作为屏幕尺寸的唯一区别
  • 在 ipad 设备上工作正常只有 ipad mini 有问题。

标签: ios objective-c ipad uiactionsheet


【解决方案1】:

可能对你有帮助,

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];

【讨论】:

    【解决方案2】:

    您在设置操作表的其他按钮标题时使用了 AALocalizedString 方法。确保该方法是否会给出字符串。如果它没有给出任何字符串,那么操作表不会显示其他按钮而不是取消按钮。或者尝试一下下面的代码。

    UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" 破坏性ButtonTitle:nil otherButtonTitles:@"Capture Document",@"Select Document" ,@"Capture Photo",@"Select Photo",零]; actionSheet.actionSheetStyle = UIActionSheetStyleDefault; [actionSheet showInView:self.view]; 动作表=无;

    【讨论】:

    • 是的,给出 nil 值的方法。谢谢
    猜你喜欢
    • 2017-03-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-18
    • 1970-01-01
    • 2017-07-26
    相关资源
    最近更新 更多