I am using Local Notifications, but I want to put an image in the message body of the alert. How can I do that?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I also searched for the same question. And found that we can't customize the UILocalNotification
, so I handled this in application:didReceiveLocalNotification:
by showing custom UIAlertView
.
回答2:
This should work. Give it a whirl:
UIAlertView *successAlert = [[UIAlertView alloc] initWithTitle:title
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(220, 10, 40, 40)];
UIImage *smiley= [UIImage imageNamed:@"smiley.png"];
[imageView setImage:smiley];
[smiley release];
[successAlert addSubview:imageView];
[imageView release];
[successAlert show];
[successAlert release];
Good luck,
Aurum Aquila
回答3:
If you are using simple images like question mark, notification, etc. I suggest Ext JS which has a Icon type alert.
You can add your images as well.