取消ios7下自带的手势滑动导航

在ios7中苹果加入了手势滑动导航,但以前做的项目和这块有一点冲突,所以想去掉苹果自带的手势滑动导航。

取消很简单,只需要自己重写左导航键就可以取消掉系统自带的手势滑动导航。

//设置左边的返回

- (void)setLeftNavigationBar

{

    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];

    backButton.frame = CGRectMake(0, 0, 170, 26);

    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(40, 0, 130, 26)];

    [label setFont:[UIFont boldSystemFontOfSize:20]];

    [label setTextColor:[UIColor whiteColor]];

    [label setText:@"返回"];

    [label setBackgroundColor:[UIColor clearColor]];

    [backButton addSubview:label];

    [backButton addTarget:self action:@selector(popChatViewController) forControlEvents:UIControlEventTouchUpInside];

    UIBarButtonItem *leftBarButtons = [[UIBarButtonItem alloc] initWithCustomView:backButton];

    self.navigationItem.leftBarButtonItem = leftBarButtons;

}


//返回到上一个界面

- (void)popChatViewController

{

    [self.navigationController popViewControllerAnimated:YES];

}


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要实现在iOS上文本框的上下滑动,可以通过以下方法实现。首先,您需要添加一个监听事件,当文本框获取焦点时,禁止默认的上下滑动效果。您可以使用以下代码来实现这一点: ```html <input type="text" id="queryTitle" value="$queryTitle" placeholder="主题" onfocus="input()" onblur="noInput()"> <script> function input() { document.body.addEventListener('touchmove', function(e) { e.preventDefault(); // 阻止默认的处理方式(阻止上下滑动的效果) }, { passive: false }); }; </script> ``` 然后,在文本框失去焦点时,您需要清除掉禁止滚动的监听事件,以实现文本框的上下滑动。可以使用以下代码来实现这一点: ```html <input type="text" id="queryTitle" value="$queryTitle" placeholder="主题" onfocus="input()" onblur="noInput()"> <script> function noInput() { document.body.removeEventListener('touchmove', function(e) { e.preventDefault(); }, { passive: false }); }; </script> ``` 需要注意的是,passive参数不能省略,它用来兼容iOS和Android。如果不写passive: false,iOS手机端将无法实现文本框的上下滑动。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [ios手机端数字显示黑色和input输入时禁止滑动的解决方案](https://blog.csdn.net/m0_65638748/article/details/126431292)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值