(@"发生内存泄漏的控制器------->%@",strongself); }); } } (3).给UINavigationController添加一个分类 在 load方法中实现popViewControllerAnimated static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ [self swizzleSEL:@selector(popViewControllerAnimated :) withSEL:@selector(dt_popViewControllerAnimated:)]; }); } -(UIViewController*)dt_popViewControllerAnimated :(BOOL)animated{ UIViewController *popVC = [self dt_popViewControllerAnimated:animated]; objc_setAssociatedObject
UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { [self.navigationController popViewControllerAnimated UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { [self.navigationController popViewControllerAnimated
; } if(shouldPop) { dispatch_async(dispatch_get_main_queue(), ^{ [self popViewControllerAnimated dispatch_async(dispatch_get_main_queue(), ^{ //APP返回上级页面动作 [self.navigationController popViewControllerAnimated
[self.webView goBack]:[self.navigationController popViewControllerAnimated:YES]; } return YES self.webView.canGoBack==YES) { [self.webView goBack]; }else{ [self.navigationController popViewControllerAnimated
self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; [self.navigationController popViewControllerAnimated
pushViewController:subTableViewController animated:YES]; 描述:通过 NSNavigationBar 进行跳转 [self.navigationController popViewControllerAnimated
{ [self.delegate saveEmail:_mailField.text]; [self.navigationController popViewControllerAnimated
IBAction)blockAction:(UIButton *)sender { if(self.backBlock){ [self.navigationController popViewControllerAnimated self.backBlock(@{@"value":@"A_Module_Page1_Block"}); }else{ [self.navigationController popViewControllerAnimated
%@", error); }]; } [self.webView goBack]; } else { [self.navigationController popViewControllerAnimated
}]; 53 } 54 55 - (void) btnClicked:(UIButton *)btn { 56 57 [self.navigationController popViewControllerAnimated transferString:)]) { [self.delegate transferString:@"子页面回传的数据"]; } [self.navigationController popViewControllerAnimated self.transDataBlock) { self.transDataBlock(@"子页面回传的数据"); } [self.navigationController popViewControllerAnimated sender.userInfo[@"content"]; } - (void) btnClicked:(UIButton *)btn { [self.navigationController popViewControllerAnimated btnClicked:(UIButton *)btn { self.content = @"子页面回传数据";//修改属性的内容 [self.navigationController popViewControllerAnimated
popViewControllerAnimated(true) 这种方式和用storyboard中的拖线选push是一样的原理 //先定义segue的ID self.performSegueWithIdentifier
_doTransferMsg(@”hello there”); _doTransferMsg = nil; } [self.navigationController popViewControllerAnimated
locationInView:[UIApplication sharedApplication].keyWindow].y; [self.navigationController popViewControllerAnimated cancelInteractiveTransition]; break; } } 要注意的是,在pan手势触发的时候,需要先调用[self.navigationController popViewControllerAnimated
显示方块 - (void)showSquare { [self.delegate showTheSquare];// 调用委托方法 [self.navigationController popViewControllerAnimated (void)dismissSquare { [self.delegate dismissTheSquare];// 调用委托方法 [self.navigationController popViewControllerAnimated
item animated:NO]; [self.view addSubview:bar]; } - (void)back{ [self.navigationController popViewControllerAnimated
将自己的值传出去,完成传值 weakself.returnValueBlock(inputString); } [self.navigationController popViewControllerAnimated
self.webView.backForwardList currentItem].title isEqualToString:@"首页"]) { [self.navigationController popViewControllerAnimated [self.webView goBack]; } }else{ [self.navigationController popViewControllerAnimated
popViewControllerAnimated(true) } } 相比之前的方法,我们获得的额外的好处是:假如我们传递的不只是字符串,而是大量的信息,比如十个不同类型的值,使用代理传值依然只需要实现一个方法
self.selectedRoomBlock(self.selectedRoom); } [self.navigationController popViewControllerAnimated
popViewControllerAnimated(true) } } //......