您的位置:首页 > 其它

NavigationBar ( with an image )

2013-11-29 17:35 260 查看
1。导航栏-navigationItem

2。标题:

simple text : self.navigationItem.title / self.title //简单文本

a view : self.navigationItem.titleView

UIImageView *imgView = [ [ UIImageView alloc ] initWithFrame : CGRectMake ( 0.0f , 0.0f . 100.0f , 40.0f ) ] ;

imgView.contentMode = UIViewContentModeScaleAspectFit ; // to fill the view

UIImage *image = [ UIImage imageNamed : @"imgName" ] ; //可不加.png,图像高度不能超过 64 / @2x:128

[ imgView setImage : image ] ;

self.navigationItem.titleView = imgView ;

p.s. 上述必须是在navigation controller 里的 view controller 里执行
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: