简体   繁体   中英

Change background Color in ios

i want to change my application background change. My view name is topNavVw for change my application background color i used this code

topNavVw.backgroundColor = [UIColor blackColor];

but it's not working .

Thanks in advance

You have to call

self.view.backgroundColor = [UIColor blackColor];

in viewDidLoad , in the Controller class that you want to appear black.

If you want a specific view/button/label to have a black background then it is the same,

myView.backgroundColor = [UIColor blackColor];

If it still doesn't work, use the view hierarchy debug (the button just before the arrow on the bottom of the screen, in the separation of the debug screen and code screen). There you will be able to see all your views and maybe you'll notice that your black view is behind another view that is not black.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM