iOS 右滑返回时将上个界面的navgationbar带到了返回后的界面 用的系统的滑动返回,在滑动返回时遇到了这种情况, navigationItem也是自定义的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 由于你的navigationItem是自定义的,所以需要在不需要它的地方,清理掉;对于你的情况,在父ViewController的ViewDidAppear清理一下了 没明白,navgationItem不是应该一直存在的吗,如果清理调的话,是不是我点击操作的时候就不能用了啊,还有我不知道怎么清理 - (void)initNavigationItem{ itemView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, BAR_BUTTON_H)] autorelease]; backButton.frame = CGRectMake(MARGINSPACE, 0, backButton.frame.size.width, backButton.frame.size.height); [itemView addSubview:backButton]; funcButton.frame = CGRectMake(itemView.frame.size.width - MARGINSPACE - funcButton.frame.size.width, 0, funcButton.frame.size.width, funcButton.frame.size.height); [itemView addSubview:funcButton]; UIBarButtonItem *right = [[[UIBarButtonItem alloc] initWithCustomView:itemView] autorelease]; // 调整 barButtonItem 在 iOS7以上的位置 float margin = -5; if (isIOS7Above()) { margin = -16; } UIBarButtonItem *negativeSpacer = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil] autorelease]; //这个数值可以根据情况自由变化negativeSpacer.width = -16; negativeSpacer.width = margin; [self.navigationItem setRightBarButtonItems:@[negativeSpacer, right]]; [self.navigationItem setLeftBarButtonItems:@[negativeSpacer]]; [itemView addSubview:titleView]; }这是初始化的代码,你看下没问题吧,其他情况都没问题就是滑动返回时会出现这个问题 第一个作品Cutball上线了。 umbrella-4.1.6WIN.rar为什么打不开? xcode gcc问题 新学ios开发,如何把已有文件导入iPhone中或iPhone Simulator里? Iphone应用如何读写SIM卡 求问ios升级APP步骤(刚学……) 多次在cell中加载网络图片后,内存增长,以前资源未释放 请问静态库的生成的文件路径在哪里修改? iOS WebView重定向问题 请问一下怎么删除开发者后台的 Identifiers 高分请教IOS中的布局高度问题 cocoa pods gem - v出现了问题 怎么样解决啊
对于你的情况,在父ViewController的ViewDidAppear清理一下了
没明白,navgationItem不是应该一直存在的吗,如果清理调的话,是不是我点击操作的时候就不能用了啊,还有我不知道怎么清理
- (void)initNavigationItem
{
itemView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, BAR_BUTTON_H)] autorelease];
backButton.frame = CGRectMake(MARGINSPACE, 0, backButton.frame.size.width, backButton.frame.size.height);
[itemView addSubview:backButton];
funcButton.frame = CGRectMake(itemView.frame.size.width - MARGINSPACE - funcButton.frame.size.width, 0, funcButton.frame.size.width, funcButton.frame.size.height);
[itemView addSubview:funcButton];
UIBarButtonItem *right = [[[UIBarButtonItem alloc] initWithCustomView:itemView] autorelease];
// 调整 barButtonItem 在 iOS7以上的位置
float margin = -5;
if (isIOS7Above()) {
margin = -16;
}
UIBarButtonItem *negativeSpacer = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace
target:nil action:nil] autorelease];
//这个数值可以根据情况自由变化negativeSpacer.width = -16;
negativeSpacer.width = margin;
[self.navigationItem setRightBarButtonItems:@[negativeSpacer, right]];
[self.navigationItem setLeftBarButtonItems:@[negativeSpacer]];
[itemView addSubview:titleView];
}这是初始化的代码,你看下没问题吧,其他情况都没问题就是滑动返回时会出现这个问题