ข้ามไปยังเนื้อหา

ตั้งค่า InboxUI ด้วย CocoaPods

1. รันคำสั่ง ‘pod init’ จากเทอร์มินัลในไดเรกทอรีโปรเจกต์ของคุณ

2. เปิดไฟล์ Podfile ที่สร้างขึ้นใหม่

3. เพิ่ม Pushwoosh dependency ภายใต้ target ชื่อโปรเจกต์ของคุณ:

# 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

4. รันคำสั่งต่อไปนี้ในเทอร์มินัลในไดเรกทอรีโปรเจกต์ของคุณ:

pod install

5. เปิดไฟล์ <your_project_name>.xcworkspace ที่สร้างขึ้นใหม่

6. ยอดเยี่ยม! คุณได้ผสานรวม Pushwoosh InboxUI เข้ากับโปรเจกต์ของคุณเรียบร้อยแล้ว

เพิ่มโค้ด Pushwoosh InboxUI

Anchor link to

หากต้องการแสดง Inbox UI ในแอปของคุณ ให้เพิ่ม Inbox view controller:

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)

การปรับแต่ง

Anchor link to

หากต้องการปรับแต่งสไตล์ของ Inbox UI โปรดอ้างอิงจาก:

สำหรับรายละเอียดเพิ่มเติม โปรดดูที่ ตัวอย่าง Inbox