views:

598

answers:

1

Hi Friends,

Is there any way to change the frame of the UIAlertView in iPhone or iPad. I tried changing the frame in the following delegate method- (void)willPresentAlertView:(UIAlertView *)alertView;

but even then the width of the Alertview remained unchanged. And I think a small Alertview in iPad will not make sense. And I guess there must be a way to achieve it, at least in iPad.

Thanks, krishnan.

+3  A: 

Hmm, this code works fine (except, when you are trying to decrease size - cause in this case you can get some bad rendering):

- (void)willPresentAlertView:(UIAlertView *)alertView {
    alertView.frame = CGRectMake(x, y, width, height);
}

Maybe, you forgot to set UIAlertView's delegate with something like someAlertView.delegate = self;

kpower
I did set the delegate. The height of the AlertView changed but not the width. Did it really work for you?
Krishnan
Yes. But, when the view's width was less then necessary for correct text displaying (rendering), the view's background frame was rendered badly (left part of the frame rectangle was rounded, but right was not).
kpower