在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];
}