后退按钮是不可见的导航栏在iPhone OS 4.0的iPhone [英] Back button is not visible in Navigation Bar in iPhone OS 4.0 in iPhone

查看:239
本文介绍了后退按钮是不可见的导航栏在iPhone OS 4.0的iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序(查看为主),后面的按钮在导航栏中可见。如果我点击该按钮,操作正常工作。这是非常奇怪的我。后退按钮是可见的,在iPhone OS 3.0和其他人正常工作。(除OS 4.0)。我目前的iPhone OS 4.0的工作。

In my application (View based), the back buttons are not visible in the navigation bar. If I click that button, the actions works properly. It's very weird to me. The back button is visible and properly working in iPhone OS 3.0 and others.(Except OS 4.0). I am currently working in iPhone OS 4.0.

下面是我的code:

UIButton *btn=[[UIButton alloc] init];

[btn setImage:[UIImage imageNamed:@"Back.png"] forState:UIControlStateNormal];

[btn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
[btn setImageEdgeInsets:UIEdgeInsetsMake(0, 70, 0, 20)];
UIBarButtonItem *b=[[UIBarButtonItem alloc] initWithCustomView:btn];    
self.navigationItem.leftBarButtonItem=b;
[b release];
[btn release]; 

请注意:它不只是工作,iPhone OS 4.0。那么,如何才能做到这一点?

Note: It doesn't work only iPhone OS 4.0. So how can I achieve this?

推荐答案

只要你无论你想更换此code和它在OS 4.0正常工作。

Simply you replace this code wherever you want and its working fine in OS 4.0.

UIButton *btn=[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 70, 40)];

UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 70, 40)];

[myView addSubview:btn];

UIImageView *myImage = [[UIImageView alloc] initWithFrame:CGRectMake(0,5,50,30)];

[myImage setImage:[UIImage imageNamed:@"Back.png"]];

[myView addSubview:myImage];

[btn addTarget:self action:@selector(lOut) forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem *b1 = [[UIBarButtonItem alloc] initWithCustomView:myView];

self.navigationItem.leftBarButtonItem = b1;

[btn release];

[b1 release];

[myView release];

[myImage release];

我希望这将有助于YPU。

I hope it will help ypu.

这篇关于后退按钮是不可见的导航栏在iPhone OS 4.0的iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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