修改NavigationController中present出来的个别ViewController状态栏颜色

2016年11月29日 iOS 6条评论 阅读7139次


修改NavigationController中present出来的个别ViewController状态栏颜色


对于整体都是push方式展示ViewController的应用,一般来说状态栏都是白色字体,但偶尔还会有presentViewController的情况,此时present出来的ViewController的背景默认是白色的,这样就导致状态栏上的运营商、信号、时间、电量等信息看不清了。

下面是针对个别present出来的ViewController临时修改状态栏颜色风格的代码。

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    // 这个页面被加载之后,状态栏设置为黑色
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
}


- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    // 页面即将消失时,状态栏再转为白色
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];
}


参考了jianshu上的一篇文章,抱歉地址没有记下来,那篇文章是swift实现的,并且状态栏设置为黑色的代码是放在viewDidLoad中,经过我的实验测试证明,viewDidLoad中去修改状态栏为黑色会在页面再次跳转到某一页面返回后重新变得状态栏为白色。


分享本文至:

WRITTEN BY

avatar
本文标签:NavigationController
看了本文是不是觉得很赞,那就赶紧点击下面按钮分享给身边的朋友吧!

6 条评论

  1. avatar meknesmorocco

    <a href="http://www.fleetboilers.com/nike-hyperdunk-2015-low-lilla-hvid-schuhee">nike hyperdunk 2015 low lilla hvid</a> <a href="http://www.jettstreaminc.com/nike-roshe-flyknit-nm-schwarz-butyd">nike roshe flyknit nm schwarz</a> <a href="http://www.maverickviral.com/hombres-salomon-xt-hawk-rojo-blanco-obuvc">hombres salomon xt hawk rojo blanco</a> <a href="http://www.iubhlis.com/adidas-tubular-runner-guld-bl%C3%A5-scarpee">adidas tubular runner guld bl氓</a> <a href="http://www.djterryhunter.com/nike-mercurial-superfly-fg-id-maschio-firm-ground-soccer-cleat-obuvd">nike mercurial superfly fg id maschio firm ground soccer cleat</a> <a href="http://www.msdarby.com/adidas-climacool-ride-vi-oro-negro-chaussuresg">adidas climacool ride vi oro negro</a>
    meknesmorocco http://www.meknesmorocco.com/

  2. avatar bluerosegear

    <a href="http://www.thedirtytaco.com/jordan-12-royal-bl%C3%A5-gs-obuvc">jordan 12 royal bl氓 gs</a> <a href="http://www.versalazer.com/air-max-zero-rose-scarpea">air max zero rose</a> <a href="http://www.aksumat.com/nike-shox-deliver-sport-rot-foxes-chaussuresg">nike shox deliver sport rot foxes</a> <a href="http://www.cletalover.com/nike-lebron-ambassador-9-violet-vert-kurpesf">nike lebron ambassador 9 violet vert</a> <a href="http://www.minruteguide.com/air-jordan-jumpman-p%C3%BArpura-cielo-azul-obuva">air jordan jumpman p煤rpura cielo azul</a> <a href="http://www.mollenteam.com/ralph-lauren-city-polo-blau-gr%C3%BCn-polot">ralph lauren city polo blau gr眉n</a>
    bluerosegear http://www.bluerosegear.com/

  3. avatar genievres

    <a href="http://www.wuxiangtaichi.com/air-jordan-retro-10-kvinners-himmelen-bl%C3%A5-s%C3%B8lv-obuvl">air jordan retro 10 kvinners himmelen bl氓 s酶lv</a> <a href="http://www.culdesacmag.com/air-jordan-3-retro-lyser%C3%B8d-skoj">air jordan 3 retro lyser酶d</a> <a href="http://www.livinggreedy.com/femminile-nike-zoom-pegasus-31-bianca-oro-scarpel">femminile nike zoom pegasus 31 bianca oro</a> <a href="http://www.clickstroy.com/womens-nike-air-max-tailwind-6-blue-gold-shoesj">womens nike air max tailwind 6 blue gold</a> <a href="http://www.zotorrent.com/air-jordan-retro-13-lilla-s%C3%B8lv-skok">air jordan retro 13 lilla s酶lv</a> <a href="http://www.viptarimas.com/air-jordan-retro-11-rosa-mint-gr%C3%B8nn-obuvp">air jordan retro 11 rosa mint gr酶nn</a>
    genievres http://www.genievres.com/

  4. avatar foliekopen

    <a href="http://www.bhcsboosters.com/bon-march%C3%A9-nike-shox-r4-femmes-runningf">bon march茅 nike shox r4 femmes</a> <a href="http://www.denisgoulart.com/35-authentic-grant-hill-detroit-pistons-jersey-mens-adidas-nba-purple-throwback-1995-all-nflv">35 authentic grant hill detroit pistons jersey mens adidas nba purple throwback 1995 all</a> <a href="http://www.donggeomdo.com/lebron-12-yellow-and-red-makeup-trainersa">lebron 12 yellow and red makeup</a> <a href="http://www.ozoessaouira.com/salomon-s-lab-xt-6-softground-negro-man-shot-scarpec">salomon s lab xt 6 softground negro man shot</a> <a href="http://www.annomaplexel.com/le-coq-sportif-dam%C3%A4nner-schuhe-rosa-gr%C3%BCn-kurpesc">le coq sportif dam盲nner schuhe rosa gr眉n</a> <a href="http://www.bringribben.com/ray-ban-aviator-1937-price-bangalore-sunglassesg">ray ban aviator 1937 price bangalore</a>
    foliekopen http://www.foliekopen.com/

  5. avatar godskingdoms

    <a href="http://www.akncmusic.com/air-jordan-retro-14-himmelen-bl%C3%A5-gamma-bl%C3%A5-schuheb">air jordan retro 14 himmelen bl氓 gamma bl氓</a> <a href="http://www.dystopianflix.com/adidas-climacool-ride-iv-herren-wei%C3%9F-chaussuresd">adidas climacool ride iv herren wei脽</a> <a href="http://www.getunladylike.com/kvinners-nike-flynit-air-max-bl%C3%A5-r%C3%B8d-butyf">kvinners nike flynit air max bl氓 r酶d</a> <a href="http://www.jesselyon.com/nike-kobe-12-bl%C3%A5-himmelbl%C3%A5-scarpea">nike kobe 12 bl氓 himmelbl氓</a> <a href="http://www.kabukcuoglu.com/air-jordan-4-retro-rot-python-schuheb">air jordan 4 retro rot python</a> <a href="http://www.karbasioun.com/air-jordan-super-fly-brun-guld-butye">air jordan super fly brun guld</a>
    [url=http://www.godskingdoms.com/]godskingdoms[/url]

  6. avatar mobilekosar

    <a href="http://www.troyafolklor.com/ray-ban-wayfarer-blue-tortoise-shell-sunglassesr">ray ban wayfarer blue tortoise shell</a> <a href="http://www.euniscpa.com/mulberry-clipper-mole-cognac-scotchgrain-mulberryd">mulberry clipper mole cognac scotchgrain</a> <a href="http://www.justwhatilove.com/nike-air-max-90-sneakerboot-dam%C3%A4nner-wei%C3%9F-sneakerd">nike air max 90 sneakerboot dam盲nner wei脽</a> <a href="http://www.kevise.com/parajumpers-vest-quick-baked-parajumpersb">parajumpers vest quick baked</a> <a href="http://www.incaradio.com/how-to-use-burberry-scarf-scarfr">how to use burberry scarf</a> <a href="http://www.qubellinfo.com/hermes-evelyne-gm-size-hermesr">hermes evelyne gm size</a>
    mobilekosar http://www.mobilekosar.com/

欢迎留言




用户登录

sitemap