是否可以在UIAlertView中显示图像? [英] Is it possible to show an Image in UIAlertView?
本文介绍了是否可以在UIAlertView中显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在UIAlertView中添加图像,比如显示plist文件中的图像?
Is it possible to add image in an UIAlertView, like showing an image from the plist file?
推荐答案
你可以做它喜欢:
UIAlertView *successAlert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(220, 10, 40, 40)];
NSString *path = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"smile.png"]];
UIImage *bkgImg = [[UIImage alloc] initWithContentsOfFile:path];
[imageView setImage:bkgImg];
[successAlert addSubview:imageView];
[successAlert show];
这将在alertview的右上角添加一个图像,你可以改变帧图像来移动。
This will add a image in the right corner of your alertview you can change the frame image to move around.
希望这会有所帮助。
这篇关于是否可以在UIAlertView中显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文