2016-05-18 8 views
0

ナビゲーションバーのタイトルに2色を設定したいと思います。 私はそれをやることができない場合、どのように私のナビゲーションバーの太さとしてイメージを完全に中心化できますか?ナビゲーションバーの[タイトル]に2色を表示できますか?

私が試した:

let logo = UIImage(named: "[email protected]"); 
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 100, height: 30)) 
imageView.image = logo 
imageView.contentMode = UIViewContentMode.ScaleAspectFit 
self.navigationItem.titleView = imageView 

をそしてそれは中心それほど小さくはないに見えます。

ありがとうございました!

+0

さまざまな属性をSOに適用する方法の例がたくさんあります。それを設定するには:http://stackoverflow.com/questions/20310929/how-to-set-kerning-on-uinavigationbar-title – Larme

答えて

0

ありがとうございましたユーザーLarme、あなたの答えは私を大きく助けました。それはどうすればいいですか:

let A = NSMutableAttributedString(string: "Label Test", attributes: [NSFontAttributeName: UIFont(name: "Georgia", size: 18)!]) 

A.addAttribute(NSForegroundColorAttributeName, value: UIColor.blueColor(), range: NSRange(location: 6, length: 5)) 

let LabelTexto: UILabel = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 30)) 

LabelText.attributedText = A 

self.navigationItem.titleView = LabelText 
関連する問題