我怎么能用图像创建一个UIAlertController

时间:2015-10-15 13:26:01

标签: ios objective-c uiactionsheet

我需要显示此图片中显示的操作表。enter image description here

    UIAlertController* alert = [UIAlertController alertControllerWithTitle:@""
                                                                                              message:@""
                                                                                             preferredStyle:UIAlertControllerStyleActionSheet];


 UIAlertAction* share = [UIAlertAction
                                           actionWithTitle:@"Share via iCloud"
                                           style:UIAlertActionStyleDefault
                                           handler:^(UIAlertAction * action)
                                           {
                                               [alert dismissViewControllerAnimated:YES completion:nil];

                                           }];
            UIAlertAction* create = [UIAlertAction
                                   actionWithTitle:@"Create Document"
                                   style:UIAlertActionStyleDestructive
                                   handler:^(UIAlertAction * action)
                                   {
                                       [alert dismissViewControllerAnimated:YES completion:nil];

                                   }];

            [share setValue:[[UIImage imageNamed:@"Help_Bar_Icn"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forKey:@"image"];
            [create setValue:[[UIImage imageNamed:@"Help_Bar_Icn"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forKey:@"image"];

            [alert addAction: share];
            [alert addAction: create];
            [self presentViewController:alert animated:YES completion:nil];

我已经将UIAlertViewController与设定值图像一起使用,但是这样图像显示在左侧。有人可以帮我,是否有像iOS页面应用程序中所示的默认控件。谢谢你

1 个答案:

答案 0 :(得分:-1)

您无法像图片一样自定义默认操作表。为此,您必须将tableview自定义为操作表。

为此,您必须实施协议