You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to set UITabBarItem titleTextAttributes from Plist. Copy the code from UINavigationBar.apperance() in the Plist Demo.
// tab bar item
let tabBarItem = UITabBarItem.appearance()
tabBarItem.theme_setTitleTextAttributes(ThemeStringAttributesPicker(keyPath: "Global.barTextColor") { value -> [NSAttributedString.Key : AnyObject]? in
guard let rgba = value as? String else {
return nil
}
let color = UIColor(rgba: rgba)
let shadow = NSShadow(); shadow.shadowOffset = CGSize.zero
let titleTextAttributes = [
NSAttributedString.Key.foregroundColor: color,
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 16),
NSAttributedString.Key.shadow: shadow
]
return titleTextAttributes
}, forState: UIControl.State.normal)
Then it crash.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Have you sent -theme_setTitleTextAttributes:forState: to <UITabBarButtonLabel: 0x7fad8c407f00; frame = (0 0; 50.3333 12); text = 'PlistDemo'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x600003f84c80>> off the main thread? To verify, look for a complaint in the logs: "Unsupported use of UIKit…", and fix the problem if you find it. If your use is main-thread only please file a radar on UIKit, and attach this log. exercisedImplementations = {
"theme_setTitleTextAttributes:forState:" = (
);
}'
The text was updated successfully, but these errors were encountered:
I didn't find the real reason. I tested UITabBarItem.appearance().theme_setTitleTextAttributes(...) and it would crash, but UITabBarItem().theme_setTitleTextAttributes(...) would not crash. I guessed inside the object returned by UITabBarItem.appearance() There is some unknown logic blocking this. I don’t have a solution right now, and I will come back to this issue in the future.
I want to set UITabBarItem titleTextAttributes from Plist. Copy the code from UINavigationBar.apperance() in the Plist Demo.
Then it crash.
The text was updated successfully, but these errors were encountered: