Problem
You want to display an image instead of text as the title of the current view controller
on the navigation controller

Solution
Use the titleView property of the view controller’s navigation item

- (void)viewDidLoad {
[super viewDidLoad]; /* Create an Image View to replace the Title View */
UIImageView *imageView =
[[UIImageView alloc]
initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, 40.0f)];
imageView.contentMode = UIViewContentModeScaleAspectFit; /* Load an image. Be careful, this image will be cached */
UIImage *image = [UIImage imageNamed:@"Logo"]; /* Set the image of the Image View */
[imageView setImage:image]; /* Set the Title View */
self.navigationItem.titleView = imageView;
}

IOS 7 Study - Displaying an Image on a Navigation Bar的更多相关文章

  1. Status bar and navigation bar appear over my view's bounds in iOS 7

    转自:http://stackoverflow.com/questions/17074365/status-bar-and-navigation-bar-appear-over-my-views-bo ...

  2. IOS 7 Study - UIViewController

    Presenting and Managing Views with UIViewController ProblemYou want to switch among different views ...

  3. IOS 7 Study - Manipulating a Navigation Controller’s Array of View

    ProblemYou would like to directly manipulate the array of view controllers associated with aspecific ...

  4. IOS 7 Study - Implementing Navigation with UINavigationController

    ProblemYou would like to allow your users to move from one view controller to the other witha smooth ...

  5. IOS 7 Study - UIActivityViewController(Presenting Sharing Options)

    You want to be able to allow your users to share content inside your apps with theirfriends, through ...

  6. IOS 7 Study - UISegmentedControl

    You would like to present a few options to your users from which they can pick anoption, through a U ...

  7. IOS 7 Study - UIDatePicker

    Picking the Date and Time with UIDatePicker effect: 1. declaring a property of type UIDatePicker #im ...

  8. IOS学习-报错误 Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

    环境:XCODE:5.0.2  IOS7模拟器 界面:使用storyboard 拖拽 简单应用:一个CoreData的CRUD用例. 界面如下图(一个UITableViewController 列表 ...

  9. IOS 怎么修改Navigation Bar上的返回按钮文本颜色,箭头颜色以及导航栏按钮的颜色

    self.navigationController.navigationBar.barTintColor = [UIColor blackColor]; self.navigationControll ...

随机推荐

  1. [Everyday Mathematics]20150222

    设 $$\bex a_0=1,\quad a_1=\frac{1}{2},\quad a_{n+1}=\frac{na_n^2}{1+(n+1)a_n}\ (n\geq 1). \eex$$ 试证: ...

  2. 【剑指offer 面试题38】数字在排序数组中出现的次数

    思路: 利用二分查找,分别查找待统计数字的头和尾的下标,最后做差加一即为结果. C++: #include <iostream> #include <vector> using ...

  3. strcpy()的实现

    看到有一个博客讲的比平时理解的更深入,mark一下:strcpy函数的实现 这里只写平时理解的,三个要点: //strcpy自己实现 char *strcpy(char *dest, const ch ...

  4. 初识---Qt解析XML文件(QDomDocument)

    关于XML及其使用场景不在此多做介绍,今天主要介绍Qt中对于XML的解析.QtXml模块提供了一个读写XML文件的流,解析方法包含DOM和SAX,两者的区别是什么呢?  DOM(Document Ob ...

  5. with 语句

    with 语句用于设置代码在特定对象中的作用域. 它的语法: with (expression) statement例如: var sMessage = "hello"; with ...

  6. 父视图 使用 UIViewAnimationWithBlocks 时,如何让子视图无动画

    tableView使用 UIViewAnimationWithBlocks 时 上面的cell也会一起出现动画, 所以在设置cell的时候 添加 [UIView performWithoutAnima ...

  7. Centos 64位安装 EPEL源

    #直接在线安装rpm包 rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm # ...

  8. RedHat/CentOS6.4---永久关闭iptables

    今天无意中发现一个现象,当我关闭iptables并且停止iptables服务,但是总会有一些出奇的事情发生,当我再次启动系统,查看iptables状态,iptables又自动开启,很是无奈啊!在Red ...

  9. AutoCAD DxfCode组码值说明

    值 说明 -5 APP:永久反应器链 -4 APP:条件运算符(仅与 ssget 一起使用) -3 APP:扩展数据 (XDATA) 标记(固定) -2 APP:图元名参照(固定) -1 APP:图元 ...

  10. Spring.Scheduling.Quartz的使用

    最近因使用Spring.Net框架而接触.了解到其与Quartz.Net的集成,即Spring.Scheduling.Quartz模块. Spring通过对Quartz.Net的封装,采用了sprin ...