I first use "
[UIAlertView alloc] initWithTitle: " to resize and customize
AlertView with image but failed.
Then I use following codes, all works fine ( alertView resized and have a image with it), But just can't have a button to dismiss the alertView. Stuck here for half day. Please help, thanks!
UIAlertView* find = [[[UIAlertView alloc] init]initWithFrame:CGRectMake(0,0,300,420)]; [find setDelegate:self]; [find setTitle:@"Sample Alert"]; [find setNeedsLayout]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(220, 10, 80, 80)]; NSString *path = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"111.png"]]; UIImage *bkgImg = [[UIImage alloc] initWithContentsOfFile:path]; [imageView setImage:bkgImg]; [bkgImg release]; [path release]; [find addSubview:imageView]; [imageView release]; [find show]; find.frame = CGRectMake(0,0,300,200); [find release];
preguntado el 25 de agosto de 12 a las 06:08
UIAlertView was not made to be initialized in such a manner. Usually you initialize a
Puedes intentar usar
[find addButtonWithTitle:@"button 1"]; . You will also need to implement the Delegado de UIAlertView to interact with the button.
If that does not work, i recommend implementing your own custom view if you are looking for a heavily modified look.
espero que esto ayude.