[英]iOS double navigation bar by set translucent OFF
首先:我與情節提要界面構建器一起工作...
我試圖給導航欄像Instagram一樣上色:
UIColor *mainColorBlue = [UIColor colorWithRed:0.071 green:0.337 blue:0.533 alpha:1];
[[UINavigationBar appearance] setBarTintColor:mainColorBlue];
[[UINavigationBar appearance] setBackgroundColor:mainColorBlue];
但是,如果我將顏色設置為mainColorBlue,則不是此顏色。 我在互聯網上讀到,這是半透明的原因。 因此我將半透明設置為OFF。
但是現在,我的問題是:如果我停用半透明並激活不透明並在外部設備上啟動應用程序,則導航欄下方是另一個導航欄。 如果我再次將半透明設置為“開”,則不會顯示第二個導航欄。 我該怎么辦,第二個導航欄消失了?
我解決了這個問題。
我在位置0,0上添加了一個子視圖以為狀態欄着色。
UIView *statusBarColor = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 64)];
statusBarColor.backgroundColor = mainColorBlue;
[self.view addSubview:statusBarColor];
因此,該視圖顯示在導航欄下方。 我刪除了此代碼,現在可以正常工作了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.