如何更改 UINotification 的警报外观?

发布于 2024-10-19 00:05:21 字数 836 浏览 2 评论 0原文

有什么方法可以改变 UINotification Alert 的外观(外观形状),就像我可以在 UIAlertView 上插入图像一样,如下所示

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Status Update" message:myString delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 30, 100, 100)];

    NSString *path = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"reminder_logo.png"]];
    UIImage *bkgImg = [[UIImage alloc] initWithContentsOfFile:path];
    [imageView setImage:bkgImg];
    [bkgImg release];
    [path release];

    [alert addSubview:imageView];
    [imageView release];

    [alert show];
    [alert release];

此代码将在 UIAlertView 上显示图像。我想要 UINotification 同样的东西,但苹果应该接受它,因为我不能改变他们的库,否则应用商店会拒绝。

is there any way to change the outlook(appearance shape) of UINotification Alert, like I can insert image on UIAlertView, as below

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Status Update" message:myString delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 30, 100, 100)];

    NSString *path = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"reminder_logo.png"]];
    UIImage *bkgImg = [[UIImage alloc] initWithContentsOfFile:path];
    [imageView setImage:bkgImg];
    [bkgImg release];
    [path release];

    [alert addSubview:imageView];
    [imageView release];

    [alert show];
    [alert release];

This code will show an image on UIAlertView. I want same thing for UINotification, but apple should accept it, because I can't alter their libraries, else rejection will happen from app store.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

樱花落人离去 2024-10-26 00:05:21

本地通知是由系统而不是您的应用程序创建和显示的。因此,您无法控制它们的呈现方式。

Local notifications are created and displayed by the system, not your app. Therefore you have no control over how they are presented.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文