2016-06-21 17 views
0

enter image description hereUIImage wird nicht in UIAlertAction angezeigt?

Mein Code ist wie:

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]; 

Antwort

0

wie auf diese Weise tun .. es wird helfen:

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];