Show an image in the alert body of a local notific

2019-03-22 06:56发布

I am using Local Notifications, but I want to put an image in the message body of the alert. How can I do that?

3条回答
The star\"
2楼-- · 2019-03-22 07:22

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.

查看更多
成全新的幸福
3楼-- · 2019-03-22 07:24

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

查看更多
劳资没心,怎么记你
4楼-- · 2019-03-22 07:41

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.

查看更多
登录 后发表回答