开发者

How to add image in place of text in navigation bar?

开发者 https://www.devze.com 2023-01-21 05:36 出处:网络
How to add image in place of text in navi开发者_开发技巧gation bar ?Can you use the titleView property of the UINavigationItem ?UINavigationBar is a subclass of UIView. Thus, you can create your UIIma

How to add image in place of text in navi开发者_开发技巧gation bar ?


Can you use the titleView property of the UINavigationItem ?


UINavigationBar is a subclass of UIView. Thus, you can create your UIImageView object and add it as a subview in your UINavigation bar.

[navigationBar addSubview:imageView];

One thing you need to keep in mind that the navigationbar dimensions which is 320X44 in Portrait & 480X20 points in landscape for iPhone.


u can create an image view with some image and add it to the title view of navigation bar

like:--

self.navigationItem.titleView = myImageView;

0

精彩评论

暂无评论...
验证码 换一张
取 消