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

2016年11月29日 iOS 10条评论 阅读8600次


修改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
看了本文是不是觉得很赞,那就赶紧点击下面按钮分享给身边的朋友吧!

10 条评论

  1. avatar mackage mini coat

    <a href="http://www.femmedeguinee.com/nike-air-jordan-1-retro-red-skou">nike air jordan 1 retro red</a> <a href="http://www.autosasart.com/under-armour-micro-g-torch-hommes-jaune-shoesa">under armour micro g torch hommes jaune</a> <a href="http://www.pcwolftech.com/golden-state-warriors-beanie-hatr">golden state warriors beanie</a> <a href="http://www.poteputi.com/air-max-1-flyknit-flyknit-men-trainersa">air max 1 flyknit flyknit men</a> <a href="http://www.minsonphoto.com/billig-nike-free-1.0-herre-s%C3%B8lv-skoe">billig nike free 1.0 herre s酶lv</a> <a href="http://www.sandeneuhofer.com/achat-nike-cortez-vintage-skoc">achat nike cortez vintage</a>
    mackage mini coat http://www.turkayambalaj.com/mackage-mini-coat-mackager

  2. avatar ndtkalashop

    <a href="http://www.danielbroman.com/ralph-lauren-long-sleeve-polo-burgundy-poloh">ralph lauren long sleeve polo burgundy</a> <a href="http://www.integrityphx.com/femminile-nike-free-run-3-oro-gituttio-foota">femminile nike free run 3 oro gituttio</a> <a href="http://www.onthecar.com/nike-kobe-x10-royal-blau-wei%C3%9F-turnschuhe-runninga">nike kobe x10 royal blau wei脽 turnschuhe</a> <a href="http://www.sallysoldit.com/asics-gel-noosa-tri-vendita-xfinity-scarpee">asics gel noosa tri vendita xfinity</a> <a href="http://www.hairsalonlush.com/nike-zoom-pegasus-31-femminile-grigio-argento-runningg">nike zoom pegasus 31 femminile grigio argento</a> <a href="http://www.robverheulen.com/nike-air-presto-wei%C3%9F-gr%C3%BCn-schuhei">nike air presto wei脽 gr眉n</a>
    ndtkalashop http://www.ndtkalashop.com/

  3. avatar vuurogen

    <a href="http://www.cnovas.com/femminile-nike-flynit-air-max-viola-bianca-scarpei">femminile nike flynit air max viola bianca</a> <a href="http://www.omnicitycorp.com/dam%C3%A4nner-nike-flyknit-racer-orangen-gr%C3%BCn-schuhej">dam盲nner nike flyknit racer orangen gr眉n</a> <a href="http://www.cmcheechalk.com/utah-jazz-new-era-nba-2-tone-shone-9twenty-cap-hath">utah jazz new era nba 2 tone shone 9twenty cap</a> <a href="http://www.armandopaz.com/femmes-nike-zoom-pegasus-33-gris-noir-chaussuresh">femmes nike zoom pegasus 33 gris noir</a> <a href="http://www.alrightdesign.com/nike-air-huarache-femminile-bianca-nero-scarpel">nike air huarache femminile bianca nero</a> <a href="http://www.parksindust.com/nike-kobe-7-gold-blue-shoesj">nike kobe 7 gold blue</a>
    vuurogen http://www.vuurogen.com/

  4. avatar houseoftys

    <a href="http://www.htpmimoza.com/nike-free-run-2-frau-schwarz-rot-schuhek">nike free run 2 frau schwarz rot</a> <a href="http://www.ayakkabiyeri.com/toronto-raptors-white-jersey-nflh">toronto raptors white jersey</a> <a href="http://www.sozoteki.com/converse-sko-svart-l%C3%A6r-high-tops-obuvi">converse sko svart l忙r high tops</a> <a href="http://www.njforward.com/mens-adidas-stan-smith-white-shoesj">mens adidas stan smith white</a> <a href="http://www.crimediainc.com/nike-lunarglide-5-purple-shoesl">nike lunarglide 5 purple</a> <a href="http://www.claybrookpenn.com/royal-blue-polo-shirts-long-sleeve-poloh">royal blue polo shirts long sleeve</a>
    houseoftys http://www.houseoftys.com/

  5. avatar machinband

    <a href="http://www.homesbyted.com/nike-herren-free-4.0-flyknit-laufen-schuh-schwarz-schuhej">nike herren free 4.0 flyknit laufen schuh schwarz</a> <a href="http://www.jserrahockey.com/nike-alle-schwarz-air-max-1-schuhei">nike alle schwarz air max 1</a> <a href="http://www.djibzphoto.com/kvinner-air-jordan-retro-3.5-gr%C3%A5-rosa-obuvj">kvinner air jordan retro 3.5 gr氓 rosa</a> <a href="http://www.vfcholdings.com/femminile-air-jordan-retro-4-bianca-grigio-viola-scarpel">femminile air jordan retro 4 bianca grigio viola</a> <a href="http://www.biancawalkden.com/hommes-adidas-springblade-drive-2.0-noirrouge-2-chaussuresh">hommes adidas springblade drive 2.0 noirrouge 2</a> <a href="http://www.sportinboston.com/nike-kd-10-floreale-scarpeh">nike kd 10 floreale</a>
    machinband http://www.machinband.com/

  6. avatar ztsurfboards

    <a href="http://www.egyptmaritime.com/air-jordan-retro-3-gr%C3%B8n-lilla-skoh">air jordan retro 3 gr酶n lilla</a> <a href="http://www.erstube.com/air-jordan-retro-10-violet-royal-bleu-chaussuresh">air jordan retro 10 violet royal bleu</a> <a href="http://www.thecardplayer.com/illinois-fighting-illini-zephyr-ncaa-black--white-competitor-cap-hatl">illinois fighting illini zephyr ncaa black  white competitor cap</a> <a href="http://www.theweedaddict.com/adidas-zx-850-noir-rose-chaussuresh">adidas zx 850 noir rose</a> <a href="http://www.thecampingman.com/air-jordan-retro-29-negro-p%C3%BArpura-zapatosk">air jordan retro 29 negro p煤rpura</a> <a href="http://www.otuzbircek.com/air-jordan-retro-3-silver-blue-shoesi">air jordan retro 3 silver blue</a>
    ztsurfboards http://www.ztsurfboards.com/

  7. avatar lovehosaga

    <a href="http://www.nhhairdesign.com/nike-air-max-lunar1-light-gris-trainers-for-venta-scarpef">nike air max lunar1 light gris trainers for venta</a> <a href="http://www.struysthuis.com/nike-air-jordan-12-retro-university-bl%C3%A5-kit-chaussuresb">nike air jordan 12 retro university bl氓 kit</a> <a href="http://www.golfcavedave.com/flyknit-lunar-3-negro-hot-lava-java-butya">flyknit lunar 3 negro hot lava java</a> <a href="http://www.yfhfoundation.com/jordan-7-grigio-schuhee">jordan 7 grigio</a> <a href="http://www.exoticbg.com/adidas-yeezy-750-boost-rot-lila-chaussurese">adidas yeezy 750 boost rot lila</a> <a href="http://www.sushantnayak.com/nike-internationalist-electric-naranja-village-obuvf">nike internationalist electric naranja village</a>
    lovehosaga http://www.lovehosaga.com/

  8. avatar calvaryneworleans

    <a href="http://www.emtecsolutions.net/nike-kaishi-sort-herre-necklace-obuve">nike kaishi sort herre necklace</a> <a href="http://www.erikspeyer.net/new-balance-990-blu-bianca-obuve">new balance 990 blu bianca</a> <a href="http://www.etuckerart.net/zx-flux-rose-and-gris-kurpesd">zx flux rose and gris</a> <a href="http://www.etxahec.net/jordan-11-low-rojo-laces-schuhee">jordan 11 low rojo laces</a> <a href="http://www.eurekapps.net/jordan-11-infrar%C3%B8d-where-to-k%C3%B8be-kurpesf">jordan 11 infrar酶d where to k酶be</a> <a href="http://www.evccharlotte.net/nike-kobe-9-high-orange-s%C3%B8lv-obuva">nike kobe 9 high orange s酶lv</a>
    calvaryneworleans http://www.calvaryneworleans.net/

  9. avatar nunbori

    <a href="http://www.adgamorese.com/nike-barn-sko-rosa-r%C3%B8d-scarpea">nike barn sko rosa r酶d</a> <a href="http://www.chiveshow.com/adidas-x-16.3-orange-gris-schuheb">adidas x 16.3 orange gris</a> <a href="http://www.dfweliquid.com/nike-hombres-air-lebron-3-elite-slides-butyf">nike hombres air lebron 3 elite slides</a> <a href="http://www.finterz.com/adidas-protator-absolado-vert-butyf">adidas protator absolado vert</a> <a href="http://www.hoodiepage.com/nike-air-presto-gr%C3%B8n-glow-obuvf">nike air presto gr酶n glow</a> <a href="http://www.makerwins.com/nike-free-flyknit-3.0-gris-violet-obuve">nike free flyknit 3.0 gris violet</a>
    [url=http://www.nunbori.com/]nunbori[/url]

  10. avatar zotorrent

    <a href="http://www.thebiarritz.com/kvinders-nike-air-max-95-gr%C3%A5-sort-skol">kvinders nike air max 95 gr氓 sort</a> <a href="http://www.voydnet.com/long-sleeve-polo-shirts-no-collar-poloh">long sleeve polo shirts no collar</a> <a href="http://www.foneandlone.com/mens-air-max-lunar-90-white-black-shoesi">mens air max lunar 90 white black</a> <a href="http://www.roomwhiz.com/nike-flyknit-zoom-agility-blue-shoesp">nike flyknit zoom agility blue</a> <a href="http://www.riffsurfers.com/mennns-nike-flyknit-lunar-3-gr%C3%B8nn-r%C3%B8d-obuvl">mennns nike flyknit lunar 3 gr酶nn r酶d</a> <a href="http://www.davidmgaines.com/adidas-neo-skate-gr%C3%B8n-r%C3%B8d-skoj">adidas neo skate gr酶n r酶d</a>
    zotorrent http://www.zotorrent.com/

欢迎留言




用户登录

sitemap