GithubHelp home page GithubHelp logo

为什么我在push里加了 设置控制器View.backgroundColor.. 导航栏设置颜色的方法都无效呢 about kmnavigationbartransition HOT 3 CLOSED

mozhouqi avatar mozhouqi commented on May 14, 2024
为什么我在push里加了 设置控制器View.backgroundColor.. 导航栏设置颜色的方法都无效呢

from kmnavigationbartransition.

Comments (3)

MoZhouqi avatar MoZhouqi commented on May 14, 2024 1

这句 viewController.view.backgroundColor = kColor_ViewBg; 改变了正常的初始化顺序,如果在 viewDidLoad 里设置导航栏背景样式的话,这个时候 self.navigationController 的值为 nil,所以其实并没有设置成功。

推荐把 viewController.view.backgroundColor = kColor_ViewBg; 放到别的地方,比如 viewDidLoad 里。

from kmnavigationbartransition.

ClegeJJ avatar ClegeJJ commented on May 14, 2024

不用继承的话... 下面代码放到哪里合适呢~

viewController.view.backgroundColor = kColor_ViewBg;

from kmnavigationbartransition.

MoZhouqi avatar MoZhouqi commented on May 14, 2024

放基类里应该是比较好的方案吧,可以用 Method Swizzling,但是不太推荐。

from kmnavigationbartransition.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.