views:

772

answers:

3

hello, 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

A: 

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.

David Kanarek
A: 

Hi,

I have the same kind of issue. Actually I needed to change the background color of the UIAlertView buttons. I have found several links here, [here][http://www.skylarcantu.com/blog/2009/08/14/custom-uialertview-color-chooser/] and [here][http://joris.kluivers.nl/iphone-dev/?p=CustomAlert]. But none of them giving me the right solution. Actually I need to do something like in the first link but as you can see the background color is changed but its seems like a rounded button is on top of a rectangular box.

I observed that there is a UIThreePartButton in the UIAlertView. Can we change this UIThreePartButton to a normal UIButton ?

or can we customize UIThreePartButton ?

Somewhere I have read that if we try to customize UIThreePartButton class Apple might reject the app. is this true ?

I need you help.

Thanks

Viraj
A: 

To get exact Solution Check out my blog....

http://viksiphoneblog.blogspot.com/2010/08/how-to-customize-alert-view.html

Vivek Sharma