UIImage 没有显示在 UIAlertAction 中?
UIImage is not show in UIAlertAction?
我的代码是这样的:
UIImage *imk= [UIImage imageWithData:imageData];
UIAlertController * alert= [UIAlertController
alertControllerWithTitle:@"Success"
message:@"Posted Successfully."
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *Action=[[UIAlertAction alloc]init];
[Action setValue:imk forKey:@"image"];
[alert addAction:Action];
[self presentViewController:alert animated:YES completion:nil];
像这样..它会有所帮助:
UIAlertController * alert= [UIAlertController
alertControllerWithTitle:@"Success"
message:@"Posted Successfully."
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* action = [UIAlertAction
actionWithTitle:@"Title"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[view dismissViewControllerAnimated:YES completion:nil];
}];
[action setValue:[[UIImage imageNamed:@"img.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forKey:@"image"];
[alert addAction:action];
[self presentViewController:alert animated:YES completion:nil];
我的代码是这样的:
UIImage *imk= [UIImage imageWithData:imageData];
UIAlertController * alert= [UIAlertController
alertControllerWithTitle:@"Success"
message:@"Posted Successfully."
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *Action=[[UIAlertAction alloc]init];
[Action setValue:imk forKey:@"image"];
[alert addAction:Action];
[self presentViewController:alert animated:YES completion:nil];
像这样..它会有所帮助:
UIAlertController * alert= [UIAlertController
alertControllerWithTitle:@"Success"
message:@"Posted Successfully."
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* action = [UIAlertAction
actionWithTitle:@"Title"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action)
{
[view dismissViewControllerAnimated:YES completion:nil];
}];
[action setValue:[[UIImage imageNamed:@"img.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forKey:@"image"];
[alert addAction:action];
[self presentViewController:alert animated:YES completion:nil];