OGeek|极客世界-中国程序员成长平台

标题: iOS Swift 从普通导航栏过渡到透明栏 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:56
标题: iOS Swift 从普通导航栏过渡到透明栏

enter image description here

我用谷歌搜索了类似的问题,但没有一个能真正解决这个问题。 我尝试从具有普通导航栏的 View Controller 推送到具有透明导航栏的新 View Controller 。 这是我用来设置导航栏透明的第二个 View Controller 中的代码

self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) self.navigationController?.navigationBar.shadowImage = UIImage() navigationController?.navigationBar.barTintColor = .clear self.navigationController?.navigationBar.isTranslucent = true

如何在过渡期间在导航栏上不出现浅灰色的情况下获得平滑过渡?



Best Answer-推荐答案


您需要做的是创建一个自定义导航栏并改为使用它。它看起来会好很多。我遇到过类似的问题,唯一为我解决的问题是创建自定义导航栏。转到您的 Storyboard并添加它:

enter image description here

关于iOS Swift 从普通导航栏过渡到透明栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44717972/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4