iOS UINavigationItem.backBarButtonItem 设置-利用系统自带返回箭头
2016-03-15 21:53
435 查看
-(void)changeViewControllerWithResult:(NSDictionary *)result{
[BusyIndicatotUtility hideHUDInController:self];
TimeBoxViewController *timeBoxVC = [self.storyboard instantiateViewControllerWithIdentifier:@"timeBoxViewController"];
viewController.resultForInitTime = result;
#pragma mark - 下一个VC即timeBoxVC的naviBar 返回按钮如果想用系统默认自带的“<”箭头,则可在[self.navigationController pushViewController:timeBoxVC animated:YES]这个方法之前 添加以下代码;或者在storyBoard中 设置navigationBarTitle的下方 添加back Item :为“Back”;
#warning - 此方法必须写在push方法之前 && 此方法设置的不是当前VC NaviBarItem,而是要pushto的那个VC的返回按钮
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] init];
backItem.title = @"Back";//字符串可随便定义或为nil
backItem.target = self;
backItem.action = @selector(back:);//此处定义的back:方法根本不会被执行,原因见下面解释,所以可以省略不写
self.navigationItem.backBarButtonItem = backItem;
#pragma mark
[self.navigationController pushViewController:timeBoxVC animated:YES];
}
#warning - self.navigationItem.backBarButtonItem的@selector方法 系统默认的是返回上一页即 [self.navigationController popViewControllerAnimated:YES]; 如果想在这里改为popTo指定的VC, 则实现不了。。因为 注意:程序根本不会走下面这个我自己添加的- (void)back:(id)sender方法,所以里面的内容方法也不会实现。。。如果下一页的返回按钮想popto指定的VC,我所能会的只能是自定义leftBarButtonItem
//此方法根本不会被执行
- (void)back:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}
[BusyIndicatotUtility hideHUDInController:self];
TimeBoxViewController *timeBoxVC = [self.storyboard instantiateViewControllerWithIdentifier:@"timeBoxViewController"];
viewController.resultForInitTime = result;
#pragma mark - 下一个VC即timeBoxVC的naviBar 返回按钮如果想用系统默认自带的“<”箭头,则可在[self.navigationController pushViewController:timeBoxVC animated:YES]这个方法之前 添加以下代码;或者在storyBoard中 设置navigationBarTitle的下方 添加back Item :为“Back”;
#warning - 此方法必须写在push方法之前 && 此方法设置的不是当前VC NaviBarItem,而是要pushto的那个VC的返回按钮
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] init];
backItem.title = @"Back";//字符串可随便定义或为nil
backItem.target = self;
backItem.action = @selector(back:);//此处定义的back:方法根本不会被执行,原因见下面解释,所以可以省略不写
self.navigationItem.backBarButtonItem = backItem;
#pragma mark
[self.navigationController pushViewController:timeBoxVC animated:YES];
}
#warning - self.navigationItem.backBarButtonItem的@selector方法 系统默认的是返回上一页即 [self.navigationController popViewControllerAnimated:YES]; 如果想在这里改为popTo指定的VC, 则实现不了。。因为 注意:程序根本不会走下面这个我自己添加的- (void)back:(id)sender方法,所以里面的内容方法也不会实现。。。如果下一页的返回按钮想popto指定的VC,我所能会的只能是自定义leftBarButtonItem
//此方法根本不会被执行
- (void)back:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
}
相关文章推荐
- UICollectionViewCell水平缩放,中间大两边小效果的实现
- jquer 基础篇 dom操作
- jquer基础篇二
- UVALive 4255 Guess【拓扑排序 】
- 62. Unique Paths
- 线段树——Ultra-QuickSort
- iOS:SVN出错 Description : The working copy is locked due to a previous error
- UI基本控件
- request.getParameterMap()使用方法
- 常见UI界面库
- hue中使用oozie的workflow执行mr
- hue中使用oozie的workflow执行mr
- UML 顺序图(时序图) sequence diagram
- codeForces-Longest Subsequence
- miniui 结束日期不能小于起始日期
- Subset sequence
- 1.3:Union-Find算法-----quick-union算法
- IOS学习之UIPanGestureRecognizer使用
- Codeforces 623E Transforming Sequence (分治+FFT)
- UITableViewCell使用小结