2016-08-05 6 views
0

私は、同様の質問に示された回答の多くを試しましたが、どれも私のために働いていません。私はナビゲーションバーの1pxの影を削除しようとしていますが、私が試したすべては、棒の色を取り除き、白く/明るい色にしてしまいます。 (?アプリの委任の内側に)それを削除する方法任意のアイデアはバーの色を削除せずにナビゲーションバーの下の影の線を削除しますか?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 


    let redPart: CGFloat = CGFloat(65)/255 
    let greenPart: CGFloat = CGFloat(107)/255 
    let bluePart: CGFloat = CGFloat(166)/255 
    UINavigationBar.appearance().shadowImage = UIImage() 
    UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default) 

    UINavigationBar.appearance().barTintColor = UIColor(red: redPart, green: greenPart, blue: bluePart, alpha: 1.0) 
    //Set the colors for bar button items and text 
    UINavigationBar.appearance().tintColor = UIColor.whiteColor() 
    UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor(), NSFontAttributeName: UIFont(name: "HelveticaNeue-Light", size: 22)!] 



    // Override point for customization after application launch. 
    NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(AppDelegate.checkForReachability(_:)), name: kReachabilityChangedNotification, object: nil); 

    self.reachability = Reachability.reachabilityForInternetConnection(); 

    self.reachability!.startNotifier() 


    return true 
} 

上記は私のコードであり、これは私が試したものです:

UINavigationBar.appearance().shadowImage = UIImage() 
UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: .Default) 

しかしたびに、どんなにそれが何であるかを行、バーが...代わりに私はそれを設定していた青色の本のように見えるし始め、あなたの

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

+0

可能な重複します。http ://stackoverflow.com/questions/32208378/how-to-remove-the-shadow-line-from-a-navigation-bar?rq = 1 カメレオンがこれを行った方法を確認することもできます: https:///github.com/ViccAlexander/Chameleon/blob/master/Pod/Classes/Objective-C/UINavigationController%2BChameleon.mまたはhttps:// githu b.com/samwize/UINavigationBar-Addition/ – Grubas

+0

[iOS7 UINavigationBar 1pxの最終行を非表示にする方法](http://stackoverflow.com/questions/19226965/how-to-hide-ios7-uinavigationbar-1px-bottom)の可能な複製 - ライン) – jjatie

答えて

3

ライン:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool 

元以下のメソッド内のコード

UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarPosition: .Any, barMetrics: .Default) 
UINavigationBar.appearance().shadowImage = UIImage() 

以下

場所シャーダウは

UINavigationBar.appearance().shadowImage = UIImage() 
UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: .Default) 

罰金ですが、あなたも確認する必要があり、ナビゲーションバーには、(これがデフォルトの設定です)、半透明ではない、あなたの固体barTintColorを表示する

UINavigationBar.appearance().isTranslucent = false

2

これを配置します。

[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] 
            forBarPosition:UIBarPositionAny 
             barMetrics:UIBarMetricsDefault]; 

[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]]; 

スウィフト:あなたが削除するために使用https://stackoverflow.com/a/35151251/1585677

+0

スウィフトの回答を投稿できますか?これは本当に助けにはなりません –

+0

私の投稿を編集しました、上記を参照してください –

+0

私は文字通りその正確なコードを示し、それが上の私の質問には役に立たないと言いました... –

関連する問題