跳到内容

使用 CocoaPods 设置 InboxUI

  1. 在项目目录的终端中运行 pod init 命令。

  2. 打开新创建的 Podfile

  3. 在您的项目名称目标下添加 Pushwoosh 依赖项:

# Uncomment the next line to define a global platform for your project
# platform: ios, ‘9.0’
target ‘MyAppdo
# Comment the next line if you don’t want to use dynamic frameworks
use_frameworks!
# Pods for MyApp
pod 'PushwooshInboxUI'
end
  1. 在项目目录的终端中运行以下命令:
pod install
  1. 打开新创建的 <your_project_name>.xcworkspace 文件。

  2. 完成!您已成功将 Pushwoosh InboxUI 集成到您的项目中。

添加 Pushwoosh InboxUI 代码

Anchor link to

要在您的应用中显示 Inbox UI,请添加 Inbox 视图控制器:

self.navigationController?.pushViewController(PWIInboxUI.createInboxController(with: PWIInboxStyle.default()), animated: true)

要使 Inbox 与您的应用外观匹配,请更改 PWIInboxStyle 的参数。您可以自定义字体、背景颜色等参数。

//creating a new Inbox style
let inboxStyle = PWIInboxStyle.customStyle(withDefaultImageIcon: UIImage.init(named: "custom_image"),
textColor: UIColor.darkText,
accentColor: UIColor.blue,
font: UIFont.systemFont(ofSize: 17))
inboxStyle?.backgroundColor = UIColor.init(white: 1, alpha: 1)
inboxStyle?.listErrorMessage = NSLocalizedString("Custom error message", comment: "Custom error message")
inboxStyle?.listEmptyMessage = NSLocalizedString("Custom empty message", comment: "Custom empty message")
PWIInboxStyle.setupDefaultStyle(inboxStyle)

要自定义 Inbox UI 样式,请参考:

有关更多详细信息,请查看 Inbox Sample