我想在UIAlertView的左上角添加图像。如何将图像添加到UIAlertView?
UIAlertView *successAlert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 40, 40)];
NSString *path = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"cloud.png"]];
UIImage *bkgImg = [[UIImage alloc] initWithContentsOfFile:path];
[imageView setImage:bkgImg];
[successAlert addSubview:imageView];
[successAlert show];
我正在使用此代码,但图像不会出现UIAlertView。请帮我
感谢您的帮助。现在通过使用此代码。图像出现在警报视图中,但在底部显示并从左向右延伸。 –
更改imageview框架 –