ฉันกำลังใช้ธีมในแอปพลิเคชันของฉัน และพบข้อผิดพลาดแปลกๆ (ฟีเจอร์?) ด้วยเหตุผลแปลก ๆ บางอย่าง ฉันไม่สามารถใช้ UIView.animate
ในคลาส UITabBarController ที่กำหนดเองของฉันเพื่อทำให้การเปลี่ยนสีของ UITabBar ของฉันเคลื่อนไหวได้ แต่รหัสเดียวกันนั้นทำงานได้อย่างสมบูรณ์ในคลาสที่กำหนดเองของ UINavigationController ของฉัน
ฉันพลาดอะไรไปรึเปล่า? มีอะไรอีกบ้างที่ฉันสามารถใช้เพื่อทำให้การเปลี่ยนสีเคลื่อนไหวได้ ฉันได้ค้นหาเอกสาร Apple แล้ว แต่ไม่พบอะไรเลย
นี่คือรหัสที่ฉันใช้ทั้งสองกรณี:
class customNavigationController: UINavigationController {
@IBOutlet weak var navBar = ThemeManager.navigationbar
func dusk(notification: NSNotification) {
UIView.animateWithDuration(1, animations: {
self.navBar?.barTintColor = UIColor(red: 79/255, green: 79/255, blue: 79/255, alpha: 1)
self.navBar?.barStyle = UIBarStyle.Black
})
}
}
และ:
class customTabController: UITabBarController {
@IBOutlet weak var tab = ThemeManager.tabbar
func dusk(notification: NSNotification) {
UIView.animateWithDuration(1, animations: {
self.tab?.barTintColor = UIColor(red: 79/255, green: 79/255, blue: 79/255, alpha: 1)
self.tab?.barStyle = UIBarStyle.Black
})
}
}