Question

can you please tell me if it is possible to use an uiimage view as uialertview button "text"? i was unable to find the answer googling..

thanks a lot

Was it helpful?

Solution

Yes, it is possible, but I wouldn't recommend it. You'd have to run through the UIAlertView's subviews until you find one that is of the right class, I would assume UIButton, and add your UIImageView on top like this:

for (UIView *v in [myAlertView subviews]) {
    if ([v isKindOfClass:[UIButton class]]) {
        //IF I AM THE RIGHT BUTTON
            [v addSubview:myUIImageView];
    }
}

To determine the correct button, you might initially give it some odd text like "foobar5" and test each button to see if that is its text, and if so, remove the text and add the UIImageView.

OTHER TIPS

You can use unicode characters, which are rendered as icons. I described it here: Adding Images to UIActionSheet buttons as in UIDocumentInteractionController

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top