iPhone 中 iPhone OS 4.0 的导航栏中不可见后退按钮
在我的应用程序(基于视图)中,后退按钮在导航栏中不可见。如果我单击该按钮,操作就会正常进行。这对我来说很奇怪。后退按钮在 iPhone OS 3.0 和其他操作系统中可见且正常工作。(OS 4.0 除外)。我目前使用 iPhone OS 4.0。
这是我的代码:
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。那么我怎样才能实现这一目标呢?
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.
Here is my 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];
Note: It doesn't work only iPhone OS 4.0. So how can I achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需将这段代码替换到任何你想要的地方,它就可以在 OS 4.0 中正常工作。
我希望它能帮助你。
Simply you replace this code wherever you want and its working fine in OS 4.0.
I hope it will help ypu.