InAppNotifications 模块是一个简单机制,用于当应用程序处于活动状态时显示通知。您可以在我的 博客 上了解更多关于此项目的信息。
使用 CocoaPods
pod 'RSZInAppNotifications'
或将 RSZInAppNotifications 文件夹添加到您的项目中。
RSZPresenter
需要一个 UIWindow
实例才能工作。将以下代码添加到 -application:didFinishLaunchingWithOptions:
[RSZPresenter setPresentingWindow:self.window];
现在您可以创建通知(假设您已经有了它的视图)
RSZNotification *notification = [RSZNotification notificationWithAssociatedView:view onTapBlock:block];
然后呈现它
[RSZPresenter presentNotification:notification];
就是这样!