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 里执行
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 里执行
相关文章推荐
- 2.14 Displaying an Image on a Navigation Bar
- IOS 7 Study - Displaying an Image on a Navigation Bar
- An example editor with table and image support
- OpenCV.2.Computer.Vision.Application.Programming.Cookbook--Scanning an image with pointers
- dissmiss a UISearchBar with an SearchBarController
- Effects with the Pixel Bender Toolkit – Part 5: Applying a filter to an image in Flash
- Navigation Through Records With TrackBar(Slider)
- Creating excel sheets through php with an image
- 《Zoom An Image With Different Interpolation Types》
- An Image Viewer with Lossless Rotation, EXIF and Other Goodies
- Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
- Using Flot's Bar Graph in an Android WebView with Highlighting
- How to mount an ISO Image with AIX 6.1 TL4
- [Creating an image format with an unknown type is an error] on cordova, ios 10
- [Generic] Creating an image format with an unknown type is an error
- Effects with the Pixel Bender Toolkit – Part 5: Applying a filter to an image in Flash
- Preloading an Image with jQuery--reference
- [转载]Flip an image in UIImageView using UIView transitionWithView
- How to rotate an image with CSS under different browser
- BadImageFormatException or An attempt was made to load a program with an incorrect format