亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

將圖像添加到UIAlertController中的UIAlertAction

將圖像添加到UIAlertController中的UIAlertAction

iOS
DIEA 2019-10-26 13:42:14
我已經看到了UIAlertControllers的幾個屏幕快照,在該行的左側有一個圖像,但是我在文檔中沒有看到它。視覺示例如下:我現在為控制器使用的代碼:UIAlertController * view =   [UIAlertController                                 alertControllerWithTitle:@"My Title"                                 message:@"Select you Choice"                                 preferredStyle:UIAlertControllerStyleActionSheet];    UIAlertAction* ok = [UIAlertAction                         actionWithTitle:@"OK"                         style:UIAlertActionStyleDefault                         handler:^(UIAlertAction * action)                         {                          }];    [view addAction:ok];    [self presentViewController:view animated:YES completion:nil];
查看完整描述

2 回答

?
至尊寶的傳說

TA貢獻1789條經驗 獲得超10個贊

UIAlertController * view=   [UIAlertController

                             alertControllerWithTitle:@"Staus ! "

                             message:@"Select your current status"

                             preferredStyle:UIAlertControllerStyleActionSheet];



UIAlertAction* online = [UIAlertAction

                     actionWithTitle:@"Online"

                     style:UIAlertActionStyleDefault

                     handler:^(UIAlertAction * action)

                     {

                         //Do some thing here

                         [view dismissViewControllerAnimated:YES completion:nil];


                     }];

UIAlertAction* offline = [UIAlertAction

                         actionWithTitle:@"Offline"

                         style:UIAlertActionStyleDefault

                         handler:^(UIAlertAction * action)

                         {

                             [view dismissViewControllerAnimated:YES completion:nil];


                         }];

UIAlertAction* doNotDistrbe = [UIAlertAction

                         actionWithTitle:@"Do not disturb"

                         style:UIAlertActionStyleDefault

                         handler:^(UIAlertAction * action)

                         {

                             [view dismissViewControllerAnimated:YES completion:nil];


                         }];

UIAlertAction* away = [UIAlertAction

                               actionWithTitle:@"Do not disturb"

                               style:UIAlertActionStyleDestructive

                               handler:^(UIAlertAction * action)

                               {

                                   [view dismissViewControllerAnimated:YES completion:nil];


                               }];


[online setValue:[[UIImage imageNamed:@"online.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forKey:@"image"];

[offline setValue:[[UIImage imageNamed:@"offline.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forKey:@"image"];

[doNotDistrbe setValue:[[UIImage imageNamed:@"DND.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forKey:@"image"];

[away setValue:[[UIImage imageNamed:@"away.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forKey:@"image"];






[view addAction:online];

[view addAction:away];

[view addAction:offline];

[view addAction:doNotDistrbe];

[self presentViewController:view animated:YES completion:nil];


查看完整回答
反對 回復 2019-10-26
  • 2 回答
  • 0 關注
  • 1077 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號