Adding Images to UIActionSheet buttons as in UIDocumentInteractionController

iphone, objective-c, uiactionsheet, uidocumentinteraction, uiimage

Solution

Try this way, i hope it may be help you.

UIActionSheet * action = [[UIActionSheet alloc] 
                      initWithTitle:@"Title" 
                      delegate:self 
                      cancelButtonTitle:@"Cancel" 
                      destructiveButtonTitle:nil 
                      otherButtonTitles:@"",nil];

[[[action valueForKey:@"_buttons"] objectAtIndex:0] setImage:[UIImage imageNamed:@"yourImage.png"] forState:UIControlStateNormal];

[[[action valueForKey:@"_buttons"] objectAtIndex:0] setImage:[UIImage imageNamed:@"yourImage_Highlighted.png"] forState:UIControlStateHighlighted];

Problem

Is it possible to add an image to the buttons of the `UIActionSheet` as seen in `UIDocumentInteractionController`? If so, please let me know how it is done.

Original source