小编Yas*_*ndo的帖子

如何在UIAlertController中添加UIImageView?

我想UIAlertController与提出警告UIImageViewActionSheet.但是,当我运行应用程序时,它正在终止.

这是我的代码:

UIAlertController *alert = [UIAlertController
                                  alertControllerWithTitle:@"Title"
                                  message:@"Welcome"
                                  preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okButton = [UIAlertAction
                            actionWithTitle:OK
                            style:UIAlertActionStyleDefault
                            handler:^(UIAlertAction *action)
                            {
                            }];
[alert addAction:okButton];
UIImageView *imgv = [[UIImageView alloc]initWithFrame:CGRectMake(20,20,50,50)];
imgv.image = [UIImage imageNamed:@"kaga.jpg"];
[alert setValue:imgv forKey:@"image"];
[self presentViewController:alert animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

objective-c uiimageview ios uialertcontroller

7
推荐指数
2
解决办法
1万
查看次数

标签 统计

ios ×1

objective-c ×1

uialertcontroller ×1

uiimageview ×1