我的UINavigationitem的TitleView在ios 6中得到了扩展 [英] My UINavigationitem's TitleView getting expanded in ios 6

查看:105
本文介绍了我的UINavigationitem的TitleView在ios 6中得到了扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我已经在uinavigation项目上应用了一个图像。它在iOS 5中正常运行但在iOS 6上进行了扩展。我在导航栏中没有向左或向右的条形按钮项目。我搜索得太多但找不到答案。如果你知道答案,请帮助我。这是我的代码 -

In my app i have applied an image on uinavigation item.It is running fine in iOS 5 but getting expanded on iOS 6.I have no left or right bar button item in navigation bar. I searched too much but couldn't find answer. Help me if you know the answer. Here is my code-

UIImageView *navigationImage=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 98, 34)];
navigationImage.image=[UIImage imageNamed:@"topNav-logo.png"];
self.navigationItem.titleView=navigationImage;

图片显示如下 -
![在此输入图片说明] [1]

and image shows like this- ![enter image description here][1]

它应该显示为低于图像,但它显示为在ios 6中展开,它在ios 5中运行良好。

It should be displayed like lower image but it is displayed like expanded in ios 6 it works good in ios 5.

提前致谢

@Marko Nikolovski-结果是![在此处输入图片说明] [2]

@Marko Nikolovski- the result is ![enter image description here][2]

推荐答案

我从iOS 6开始遇到同样的问题,发现了最疯狂的解决方法:

I have the same issue starting at iOS 6, and found the craziest workaround:

再创建一个相同的UIImageView尺寸。然后将navigationImage添加为子视图。在我的情况下,这将阻止自动调整大小。

Create one more UIImageView of the same dimension. Then add the navigationImage as a subview to that. In my case this will prevent the auto resizing.

UIImageView *workaroundImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 98, 34)];
[workaroundImageView addSubview:navigationImage];
self.navigationItem.titleView=workaroundImageView;

如果有人找到合适的解决方案或解释,请发布。

If anyone finds a proper solution or an explanation please post it.

这篇关于我的UINavigationitem的TitleView在ios 6中得到了扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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