方便进行pop到指定页面,对于栈内多个类 可以对数量进行限定
/*** 跳转到指定栈内的类 */
+(void)popToSpecailVcWithName:(NSString *)vcName withParams:(NSDictionary*)data{
__block UIViewController*targetVC = nil;
UIViewController *currentVC = [self FNK_findVisibleViewController];
NSMutableArray *dataArr = [NSMutableArray arrayWithArray:currentVC.navigationController.viewControllers];
[dataArr enumerateObjectsUsingBlock:^(UIViewController * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:NSClassFromString(vcName)]) {
targetVC = obj;
if (data.count >0) {
[self setValueToVC:targetVC withData:data];
}
*stop = YES;
}
}];
[currentVC.navigationController popToViewController:targetVC animated:YES];
}
网友评论