2013-12-20 153 views
0

我正在開發一款應用程序,並希望使導航欄透明。這是可能的或將導航欄要麼可見或完全隱藏?在下面的圖片中,我希望NavBar清晰,但Back Arrow仍然可見。沿着同樣的路線,我將如何更改後退按鈕的文本。iOS 7清除導航欄

謝謝!

enter image description here

+0

看到這麼回答http://stackoverflow.com/questions/19029833/ios-7-navigation-bar-text-and-arrow-添加以下代碼顏色 – Deepesh

回答

0

以下是方法來設置可見導航爲您的應用程序。這裏是完整的指南:http://www.appcoda.com/customize-navigation-status-bar-ios-7/

添加下面的代碼在你的 - (BOOL)申請:(UIApplication的*)應用程序didFinishLaunchingWithOptions:(NSDictionary的*)launchOptions方法

#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] 

// iOS 7 Changes - Set the Font,Font Size and Navigation bar Background 
    [[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x0219FF)]; //324F85 color you want to set 
    NSShadow *shadow = [[NSShadow alloc] init]; 
    shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8]; 
    shadow.shadowOffset = CGSizeMake(0, 1); 
    [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: 
                  [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName, 
                  shadow, NSShadowAttributeName, 
                  [UIFont fontWithName:@"Helvetica Neue" size:21.0], NSFontAttributeName, nil]]; 
    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]]; 
+0

感謝您的幫助,但是當我進行上述更改時,我仍然可以得到與上述相同的內容。這是我的原始代碼。 '[UINavigationBar appearance] setTintColor:[UIColor whiteColor]]; [[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.0]]; – James

-1

關於你的第二個答案,這是一個有點怪異,但後退按鈕實際上屬於它支持的視圖控制器。所以在這種視圖控制器,你應該把

self.navigationItem.backBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil]; 

變化傻冒選擇

0

添加以下代碼的標題在您的視圖控制器來改變返回按鈕的文本顏色。

[navController.navigationBar setTintColor:[UIColor colorWithRed:68.0/255.0 green:91.0/255.0 blue:120.0/255.0 alpha:1.0]]; 

或在您的應用程序代理

[[UINavigationBar appearance] setTintColor:[UIColor yellowColor]];