簡體   English   中英

iOS 7狀態欄使用ViewController與NavigationBar碰撞

[英]iOS 7 Status Bar Collides With NavigationBar using ViewController

我是iOS開發的初學者。 目前,我已將ios5代碼遷移到ios7。

在我的代碼中出現以下重疊問題: http : //s17.postimg.org/90m7mx5lb/collide.png

我已使用以下代碼更新了應用程序委托:

self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);

接口等直接通過ViewController代碼生成,而不使用Interface Builder或StoryBuilder。

請指教..

更新:

在所有ViewController中使用以下內容

UIImage *stretchImage=[UIImage imageNamed:kNavigationBg]; stretchImage=[stretchImage stretchableImageWithLeftCapWidth:1 topCapHeight:0]; [self.navigationController.navigationBar setBackgroundImage:stretchImage forBarMetrics:UIBarMetricsDefault];

選擇情節提要中的每個ViewController,然后在“頂部欄下方”,“底部欄下方”兩個選項中打勾

在此處輸入圖片說明

以編程方式

self.edgesForExtendedLayout = UIRectEdgeNone;

在用戶列表中將基於View Controller的狀態欄外觀設置為NO。

您應該添加

if(IS_IOS7)
{
    self.edgesForExtendedLayout=UIRectEdgeNone;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM