Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> iOS

วิธีเปลี่ยนสีข้อความ Navigation Bar ใน iOS

เปลี่ยนสีข้อความ Navigation Bar ทำได้ใน AppDelegate

ขั้นตอน

  1. Embed View Controller ใน Navigation Controller ตั้ง Navigation Item Title
  2. วิธีเปลี่ยนสีข้อความ Navigation Bar ใน iOS
  3. ใน AppDelegate.swift didFinishLaunchingWithOptions:
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    let textColor = [NSAttributedString.Key.foregroundColor: UIColor.green]
    UINavigationBar.appearance().titleTextAttributes = textColor
    return true
    }
  4. รันแอป Title จะเป็นสีเขียว

วิธีเปลี่ยนสีข้อความ Navigation Bar ใน iOS