从 MHNotificationHelper 分支出来的项目,支持 iOS8 及以上版本(说明不同)和翻译成几种语言。
iOS7(左侧)和 iOS8/iOS9(右侧)的步骤
ca, de, en, es, fr, id, it, ja, pl, pt, ru, sv, zh-Hant, zh-Hans
如果您想添加其他语言的翻译,请通过 Twitter / 电子邮件 联系我。我会尽快答复。
使用 CocoaPods 添加此库到您的项目非常容易,您必须将其添加到 Podfile 中,然后运行 pod install
。
pod 'STNotificationHelper'
##用法
首先,您必须在代码中引入该库
#import <STNotificationHelperViewController.h>
然后添加以下代码以显示视图控制器辅助工具
NSString *title = NSLocalizedString(@"Take advantage of MySuperApp", nil);
NSString *description = NSLocalizedString(@"MySuperApp is better with Push Notifications. We will spam you a lot! :)", nil);
STNotificationHelperObject *notificationObject = [STNotificationHelperObject objectWithTitle:title description:description];
STNotificationHelperViewController *notificationHelper = [STNotificationHelperViewController.alloc initWithNotification:notificationObject];
[self presentViewController:notificationHelper animated:YES completion:nil];
或者,您可以设置自己的应用图标和名称
NSString *title = NSLocalizedString(@"Take advantage of MySuperApp", nil);
NSString *description = NSLocalizedString(@"MySuperApp is better with Push Notifications. We will spam you a lot! :)", nil);
UIImage *icon = [UIImage imageNamed: @"myLogo.png"];
NSString *appName = @"My app name";
STNotificationHelperObject *notificationObject = [STNotificationHelperObject
objectWithTitle:title
description:description
appIcon:icon
appName:appName];
STNotificationHelperViewController *notificationHelper = [STNotificationHelperViewController.alloc initWithNotification:notificationObject];
[self presentViewController:notificationHelper animated:YES completion:nil];
您可以在 变更日志 中查看所有更改记录。
STNotificationHelper 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。
通过 gittip 支持此项目。