【问题标题】:Setting titleTextAttriubutes of navigationBar crashes the app only on ios 7.1 device not simulator设置 navigationBar 的 titleTextAttriubutes 仅在 ios 7.1 设备而不是模拟器上使应用程序崩溃
【发布时间】:2014-08-14 01:22:20
【问题描述】:

这是导致应用崩溃的代码

navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: NAV_BAR_TINT_COLOR]

这是输出

2014-08-13 18:21:47.567 demoapp[1214:60b] *** NSForwarding: warning: object 0x102e90000 of class '_TtCSs29_NativeDictionaryStorageOwner0000000156D27548' does not implement methodSignatureForSelector: -- trouble ahead
(lldb) 

这条线曾经使用 xcode 6 beta 4,我刚刚更新到 xcode 6 beta 5 并且应用程序崩溃

【问题讨论】:

    标签: ios iphone swift xcode6


    【解决方案1】:

    你可以试试这个吗?

    [[UINavigationBar appearance]setTitleTextAttributes:@{UITextAttributeTextColor : [UIColor whiteColor]}];
    

    【讨论】:

    • 我能知道 y m 是负数吗?请至少尝试
    • 这是 Objective-C,OP 是关于 Swift 的。
    【解决方案2】:
      This code work for me.May be it's helpful for you.
    
     let titleDict: NSDictionary = [NSForegroundColorAttributeName: UIColor.greenColor()]
     self.navigationController.navigationBar.titleTextAttributes =  titleDict
     self.navigationController.navigationBar.tintColor = UIColor.whiteColor()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-24
      • 2012-07-09
      • 1970-01-01
      • 1970-01-01
      • 2016-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多