2016-09-23 5 views
0

ナビゲーションバーの背景画像を使用しています。そして、View Controllerを提示しながら私のアプリをクラッシュさせている。私はまた、すべてのビューコントローラのビューの背景イメージを持っています。 UIColor = UIColor(patternImage:UIImage(命名:!AppImagesName.PatternRed))iOSのナビゲーションバーに背景画像を使用するとアプリがクラッシュする

そして、私はこれらを取得しています私はnavigationColorを聞かせて このイメージを、このメソッドを呼び出して、この

func setNavigationAppearance(tintColor : UIColor, barTintColor : UIColor?) { 
    let navigationBarAppearace = appDelegateObj.navigationController!.navigationBar 

    navigationBarAppearace.tintColor = tintColor 
    navigationBarAppearace.barTintColor = barTintColor 
    navigationBarAppearace.translucent = false 

    //navigationBarAppearace. 
    //Settign the Custome Font and TextColor 

    if let font = UIFont(name: FontCustom.Regular, size: 17) { 
     UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: font ,NSForegroundColorAttributeName : tintColor] 
    } 
} 

のように実装し使用しています クラッシュログキャッチされない例外により「NSInternalInconsistencyException」、理由にアプリを終了

:「のみRGBAまたはホワイトカラースペースは、私はこの件についてGoogleで検索

このような状況ではサポートされている、すべてのことが、背景画像を削除すると言っていますかこれはiOSのバグです。

ですから、解決策になる可能性があることを教えてください。

+0

ここでは、ナビゲーションバーの背景画像を設定するには? – KSR

+0

@SathiReddy質問を更新しました。見てください。 –

+0

私はあなたの問題に取り組んでいます... – KSR

答えて

1

次のコードを使用し、NavigationBarに背景画像を設定するには:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
     // Override point for customization after application launch. 

     if let myImage = UIImage(named: "navBarImage.jpg"){ 
      UINavigationBar.appearance().setBackgroundImage(myImage, for: .default) 
     } 


     return true 
    } 

サンプルのスクリーンショット:試験サンプルに

enter image description here

を、私のGitHubのリンクを確認してください。

https://github.com/k-sathireddy/NavigationBarBackgroundImageSample

+0

ありがとう、私はテストしています。 –

+0

それはあなたのために働いていますか? – KSR

+0

ありがとうございます。それはまだクラッシュしていない。もしそれがクラッシュするなら、私はあなたに知らせるでしょう。 –

関連する問題