Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
672 views
in Technique[技术] by (71.8m points)

uinavigationcontroller - 自定义UINavigationBar可以工作,只有一个ViewController除外(Customizing UINavigationBar works except only one ViewController)

I customized UINavigationBar globally in AppDelegate.

(我在AppDelegate中全局自定义了UINavigationBar。)

let appearance = UINavigationBar.appearance()
appearance.barTintColor = My Color
appearance.tintColor = UIColor.white
appearance.isTranslucent = false
let textAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white,
                      NSAttributedString.Key.font: My Font]
appearance.titleTextAttributes = textAttributes as [NSAttributedString.Key : Any]

UIBarButtonItem.appearance().setTitleTextAttributes (
        [
            NSAttributedString.Key.font: My Font,
            NSAttributedString.Key.foregroundColor: UIColor.white
        ], for: .normal)

UILabel.appearance(whenContainedInInstancesOf: [UIAlertController.self]).numberOfLines = 0

It works great on every viewController as shown below.

(如下所示,它在每个viewController上都很好用。)

在此处输入图片说明

But only one viewController shows different appearance as shown below.

(但是只有一个viewController会显示不同的外观,如下所示。)

在此处输入图片说明

This viewController is pushed by another viewController which is embed in UINavigation Controller.

(该viewController由嵌入在UINavigation Controller中的另一个viewController推动。)

I have many other viewControllers that is pushed like this way and all they work as expected.

(我还有许多其他以这种方式推送的viewControllers,它们均按预期工作。)

I see no differences in the way I implemented this viewController.

(我看不到实现此viewController的方式的差异。)

Deleting this VC, presenting VC, navigationVC and re-creating them all didn't work.

(删除此VC,显示VC,navigationVC并重新创建它们均无效。)

Anyone has this kind of issue?

(有人遇到这种问题吗?)

I am developing on XCode 11.2.1 / iOS 13

(我正在XCode 11.2.1 / iOS 13上进行开发)

  ask by Vincent Gigandet translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...