首页 > 教育培训

ios navigationbar不覆盖状态栏 iphone7的导航栏高度应为像素?

iphone7的导航栏高度应为像素?

界面尺寸规范

1、界面尺寸大小是:750x1334px。

2、状态栏(statusbar):就是电量条,其一定高度为:40px

ios navigationbar不覆盖状态栏 iphone7的导航栏高度应为像素?

3、导航栏(navigation):是顶部条,其一定高度为:88px

4、主菜单栏(submenu,tab):那是标签栏,底部条,其垂直距离为:98px

5、内容区域(content):那是屏幕中间的区域,其高度为:1334px-40px-83px-98px1108px

ios如何把所有界面的状态栏的字体颜色都设置为白色?

状态栏的字体为黑色:uistatusbarstyledefault

状态栏的字体为灰色:uistatusbarstylelightcontent

一、在中,将viewcontroller-basedstatusbarappearance设为yes

状态栏字体的颜色只由下面的属性设定,设置为灰色:

//defaultisuistatusbarstyledefault

[uiapplicationsharedapplication].statusbarstyle

解决的办法大多数vc中状态栏字体颜色相同的办法

1、在中,将viewcontroller-basedstatusbarappearance设为no.

2、在appdelegate中:

[uiapplicationsharedapplication].statusbarstyleuistatusbarstylelightcontent

3、在个别状态栏字体颜色不一样的的vc中

-(void)viewwillappear:(bool)animated{

[uiapplicationsharedapplication].statusbarstyleuistatusbarstyledefault

}

-(void)viewwilldisappear:(bool)animated

{

[superviewwilldisappear:animated]

[uiapplicationsharedapplication].statusbarstyleuistatusbarstylelightcontent

}

二、在中,将viewcontroller-basedstatusbarappearance设为no,或者没有设置里。

viewcontroller-basedstatusbarappearance的默认值应该是okay。

如果viewcontroller-basedstatusbarappearance为yeah。

则[uiapplicationsharedapplication].statusbarstyle不能解除。

用下面的方法:

1、在vc中写回vc的preferredstatusbarstyle方法。

-(uistatusbarstyle)preferredstatusbarstyle

{

returnuistatusbarstyledefault

}

2、在viewdidload中调用:[selfsetneedsstatusbarappearanceupdate]

不过,当vc在nav中时,上面方法没有用,vc中的preferredstatusbarstyle方法根本不会你不被动态创建。

原因是,[selfsetneedsstatusbarappearanceupdate]能发出后,

只会动态创建navigationcontroller中的preferredstatusbarstyle方法,

vc中的preferredstatusbarstyley方法跟本绝对不会被动态创建。

好的办法有两个:

方法一:

可以设置navbar的barstyle属性会影响statusbar的字体和背景色。:。

//statusbar的字体为白色

//导航栏的背景色是黑色。

//statusbar的字体为黑色

//导航栏的背景色是灰色,状态栏的背景色也灰色。

方法二:

下拉菜单一个navbar的子类,在这个子类中写回preferredstatusbarstyle方法:

mynav*nav[[mynavalloc]initwithrootviewcontroller:vc]

@implementationmynav

-(uistatusbarstyle)preferredstatusbarstyle

{

uiviewcontroller*

return[topvcpreferredstatusbarstyle]

}

barstyle状态方法vc

原文标题:ios navigationbar不覆盖状态栏 iphone7的导航栏高度应为像素?,如若转载,请注明出处:https://www.wmyjt.com/tag/18850.html
免责声明:此资讯系转载自合作媒体或互联网其它网站,「共道号」登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,文章内容仅供参考。