0

alertView在整个应用程序中添加。我想更改确定或取消按钮的大小, alertView以便我可以设置动作的小图像。

任何人都请帮助我。

4

2 回答 2

0

You can not change the size of ok or cancel button in alertView.

The only solution that I could figure is to make a custom view with UIVisualEffect and show it like UIActionSheet

Welcome if other solution is there :)

if you want to do this for adding image, then try following way:

UIAlertController * view=   [UIAlertController
                             alertControllerWithTitle:@"Add Image"
                             message:@"Image Added successfully"
                             preferredStyle:UIAlertControllerStyleActionSheet];


UIAlertAction* add = [UIAlertAction
                     actionWithTitle:@"add"
                     style:UIAlertActionStyleDefault
                     handler:^(UIAlertAction * action)
                     {
                         //Do some thing here
                         [view dismissViewControllerAnimated:YES completion:nil];

                     }];
[add setValue:[[UIImage imageNamed:@"add.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forKey:@"image"];
[view addAction:add];
[self presentViewController:view animated:YES completion:nil];
于 2017-01-05T07:52:17.367 回答
0

You cannot change the frame of default Alert view for this you have to use custom alert view. Please refer the below links for custom alert views

  1. https://github.com/dogo/SCLAlertView
  2. https://github.com/vikmeup/SCLAlertView-Swift (Swift)
  3. https://github.com/mtonio91/AMSmoothAlert
于 2017-01-05T07:52:32.990 回答