problem in changing size of uialertview problem in changing size of uialertview xcode xcode

problem in changing size of uialertview


To achieve what you want, in your code, after:

[find show];

add:

find.frame = CGRectMake(0,0,300,200);

It's not pretty though, I suggest you use ActionSheets.


UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Confirmation" message:@" Submit the answer " delegate:self cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil];[alert show];[alert release];UILabel *theTitle = [alert valueForKey:@"_titleLabel"];[theTitle setTextColor:[UIColor blackColor]];UILabel *theBody = [alert valueForKey:@"_bodyTextLabel"];[theBody setTextColor:[UIColor blackColor]];UIImage *theImage = [UIImage imageNamed:@"blue-white-abstract-background.jpg"];    theImage = [theImage stretchableImageWithLeftCapWidth:10 topCapHeight:10];CGSize theSize = [alert frame].size;UIGraphicsBeginImageContext(theSize);    [theImage drawInRect:CGRectMake(0, 0, theSize.width, theSize.height)];    theImage = UIGraphicsGetImageFromCurrentImageContext();    UIGraphicsEndImageContext();//[[alert layer] setContents:[theImage CGImage]];[[alert layer] setContents:[UIColor clearColor]];

This code does a lot of things to alertview and modify it to increase the size of the alert view.


This does the job pretty well, and does not look weird when the alert appear (ahmet emrah solution has a pretty bad side effect).

CGAffineTransform myTransform = CGAffineTransformMakeScale(1.0, 0.5f);[alert setTransform:myTransform];