如何在iPhone应用程序的导航栏中显示图像? [英] how to display an image in the navigation bar of an iPhone application?

查看:144
本文介绍了如何在iPhone应用程序的导航栏中显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在iPhone应用程序的导航栏中显示图像? (比如,在标题之后)

how to display an image in the navigation bar of an iPhone application? (say, right after the title)

推荐答案

以下是如何将图像置于NavBar中心。

Here's how to have the image centered in the NavBar.

UIImage *image = [UIImage imageNamed: @"NavBarImage.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage: image];

self.navigationItem.titleView = imageView;

[imageView release];

此代码实际上包含在NavBar的Apple源代码中,可以在iPhone开发人员中心找到在Apple。
来源显示了操纵StatusBar和amp;的各种方法。 NavBar。

This code is actually contained with the Apple source for the NavBar and can be found at the iPhone Developer Center at Apple. The source shows you various ways to manipulate both the StatusBar & NavBar.

这篇关于如何在iPhone应用程序的导航栏中显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆