UINavigationItem setHidesBackButton:YES不会阻止返回 [英] UINavigationItem setHidesBackButton:YES won't prevent from going back

查看:31
本文介绍了UINavigationItem setHidesBackButton:YES不会阻止返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这很奇怪,但是即使您将与视图关联的UINavigationItem的hidesBackButton声明为YES,您也可以仅触摸要用作后退按钮的区域即可返回.

分享我的解决方案...(解决方案

首先,我认为这是模拟器错误,并已上传至设备.但是,当我在那里复制相同的行为时,我也开始思考如何摆脱这种行为(因为这对我来说是必不可少的).提出了这样的解决方案:

  [self.navigationItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithCustomView:[[UIView new] autorelease]] autorelease]] ;; 

要再次显示后退按钮,请输入:

  [self.navigationItem setLeftBarButtonItem:nil]; 

那很简单.伙计们,将其用作解决方法!非常奇怪的是,即使在iPhone OS 3.0中,该错误仍然存​​在.

It's odd, I know, but even if you stated hidesBackButton to YES for the UINavigationItem associated with your view, you will be able to go back just touching the area that was meant to be a back button.

Sharing my solution... (more to come)

解决方案

First I thought it was a simulator bug and uploaded to the device. But when I reproduced the same behavior there as well I started to think how to get rid of such behavior (since it was essential for me). Came up to such a solution:

[self.navigationItem setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithCustomView:[[UIView new] autorelease]] autorelease]];

And to show the back button again you write:

[self.navigationItem setLeftBarButtonItem:nil];

That's simple. Use it as a work-around, guys! Very strange this bug survived even in iPhone OS 3.0...

这篇关于UINavigationItem setHidesBackButton:YES不会阻止返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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