123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- //
- // pageControl.m
- // XLChat
- //
- // Created by 张灿 on 2017/11/13.
- // Copyright © 2017年 张灿. All rights reserved.
- //
- #import "UIViewController+VQ_PageControl.h"
- #import "YOUPAILCVerifyBigCastVC.h"
- #import "YOUPAILCCameraAuditVC.h"
- #import "YOUPAILCWeixinVC.h"
- #import "YOUPAILZVipVC.h"
- #import "YOUPAILZGameAccompanyListVC.h"
- #import "YOUPAILCBoardVC.h"
- #import "YOUPAIXRWalletVC.h"
- #import "MSYMineinfoEditVC.h"
- #import "YOUPAILCBindPhoneAccountVC.h"
- #import "UIViewController+TFPresent.h"
- static const char *PresentedVCsKey = "PresentedVCsKey";
- @implementation UIViewController (PageControl)
- + (void)exchangeInstanceMethod1:(SEL)method1 method2:(SEL)method2{
- method_exchangeImplementations(class_getInstanceMethod(self, method1), class_getInstanceMethod(self, method2));
- }
- + (void)load{
- [self exchangeInstanceMethod1:@selector(viewDidAppear:) method2:@selector(lz_viewDidAppear:)];
- }
- -(void)lz_viewDidAppear:(BOOL)animated{
- [self lz_viewDidAppear:animated];
- if (self.presentedVCs.count != 0) {
- [self showWindowWithFormController:self toController:self.presentedVCs[0]];
- }
- }
- - (void)showWindowWithFormController:(UIViewController *)formvc toController:(UIViewController *)tovc{
- [formvc TFPresentVC:tovc completion:^{
- NSInteger index = [self.presentedVCs indexOfObject:tovc];
- if (index != self.presentedVCs.count - 1) {
- [self showWindowWithFormController:tovc toController:self.presentedVCs[index + 1]];
- }else{
- [self.presentedVCs removeAllObjects];
- }
- }];
- }
- - (void)youpaifpageToStr:(NSString*)str{
- if ([str isEqualToString:@"inviteDetail"]) {
-
- }
- else if([str containsString:@"wexinPublic"])
- {
- YOUPAILCWeixinVC* invite = [[YOUPAILCWeixinVC alloc]init];
- [self.navigationController pushViewController:invite animated:YES];
- }
- else if([str isEqualToString:@"member"])
- {
- // if([LCSaveModel getUserModel].userinfo.gender==2)
- // {
- // YOUPAILZVipVC* invite = [[YOUPAILZVipVC alloc]init];
- // [self.navigationController pushViewController:invite animated:YES];
-
- YMMemberCenterViewModel *memberCenterVM = [[YMMemberCenterViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_MEMBER_CENTER) withUserInfo:@{
- RouterViewModel:memberCenterVM
- } completion:nil];
- // }
-
- }else if ([str isEqualToString:@"rank"]){
- YMRankingViewModel *rankingVM = [[YMRankingViewModel alloc]initWithParams:@{}];
- [YMRouter openURL:stringFormat(@"%@%@", YM_ROUTER_URL_PREFIX, YM_ROUTER_RANKING) withUserInfo:@{
- RouterViewModel:rankingVM
- } completion:nil];
-
- }
- else if ([str isEqualToString:@"help"]){
- NSString *urlStr;
- if ([LCSaveModel getUserModel].youpaipuserinfo.youpaipgender==1) {
- urlStr = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,HelpBigCastH5];
- }else{
- urlStr = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,HelpNormalH5];
- }
- if([LCSaveData getIsspecial]){
- urlStr = [NSString stringWithFormat:@"%@%@",[LCSaveData getBaseURL]?[LCSaveData getBaseURL]:BaseURL,HelpSpecialH5];
- }
- ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init];
- vc.contentUrl = urlStr;
- [self.navigationController pushViewController:vc animated:YES];
- }else if ([str isEqualToString:@"rechargeMoney"]){
- // YOUPAIXRWalletVC* moneyRecharge = [[YOUPAIXRWalletVC alloc]init];
- // [self.navigationController pushViewController:moneyRecharge animated:YES];
- YMAccountBalanceViewModel *accountBalanceVM = [[YMAccountBalanceViewModel alloc]initWithParams:@{
- ParamsId:@([[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id intValue])
- }];
- [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_ACCOUNT_BALANCE) withUserInfo:@{
- RouterViewModel:accountBalanceVM
- } completion:nil];
- }else if([str isEqualToString:@"rechargeCoin"]){
- // YOUPAIXRWalletVC* coinRecharge = [[YOUPAIXRWalletVC alloc]init];
- // [self.navigationController pushViewController:coinRecharge animated:YES];
- YMAccountBalanceViewModel *accountBalanceVM = [[YMAccountBalanceViewModel alloc]initWithParams:@{
- ParamsId:@([[LCSaveModel getUserModel].youpaipuserinfo.youpaipuser_id intValue])
- }];
- [YMRouter openURL:stringFormat(@"%@%@",YM_ROUTER_URL_PREFIX,YM_ROUTER_ACCOUNT_BALANCE) withUserInfo:@{
- RouterViewModel:accountBalanceVM
- } completion:nil];
- }else if ([str isEqualToString:@"applyBigCast"]){
- if ([LCSaveModel getUserModel].youpaipuserinfo.youpaipis_anchor ==0) {
- YOUPAILCVerifyBigCastVC* verBigCast = [[YOUPAILCVerifyBigCastVC alloc]init];
- [self.navigationController pushViewController:verBigCast animated:YES];
- }
- }else if ([str isEqualToString:@"auditCamera"]){
- YOUPAILCCameraAuditVC* audit = [[YOUPAILCCameraAuditVC alloc]init];
- [self.navigationController pushViewController:audit animated:YES];
- }else if([str isEqualToString:@"gameOrderList"]){
- YOUPAILZGameAccompanyListVC *vc = [[YOUPAILZGameAccompanyListVC alloc] init];
- [self.navigationController pushViewController:vc animated:YES];
- }else if([str isEqualToString:@"infoEdit"]){
- MSYMineinfoEditVC * editvc = [MSYMineinfoEditVC new];
- [self.navigationController pushViewController:editvc animated:true];
- }else if([str isEqualToString:@"bindPhone"]){
- YOUPAILCBindPhoneAccountVC* bindAccount = [[YOUPAILCBindPhoneAccountVC alloc]init];
- [self.navigationController pushViewController:bindAccount animated:YES];
- }else if([str isEqualToString:@"auth"]){
- [LCTools goRealNamePage];
- }else if([str isEqualToString:@"main"]){
- [[NSNotificationCenter defaultCenter] postNotificationName:@"LeaveLive" object:nil userInfo:nil];
- [self.tabBarController setSelectedIndex:0];
- [self.tabBarController.navigationController popToRootViewControllerAnimated:YES];
- [self.navigationController popToRootViewControllerAnimated:YES];
- }else if([str isEqualToString:@"dynamic"]){
- [self.tabBarController setSelectedIndex:1];
- [self.tabBarController.navigationController popToRootViewControllerAnimated:YES];
- [self.navigationController popToRootViewControllerAnimated:YES];
- }else if([str isEqualToString:@"msg"]){
- [self.tabBarController setSelectedIndex:2];
- [self.tabBarController.navigationController popToRootViewControllerAnimated:YES];
- [self.navigationController popToRootViewControllerAnimated:YES];
- }else if([str isEqualToString:@"my"]){
- [self.tabBarController setSelectedIndex:3];
- [self.tabBarController.navigationController popToRootViewControllerAnimated:YES];
- [self.navigationController popToRootViewControllerAnimated:YES];
- }
-
- if (self.navigationController != nil) {
- self.presentedVCs = [NSMutableArray array];
- UIViewController *vc = self;
- while (0 == 0) {
- if (vc.presentedViewController != nil) {
- [self.presentedVCs addObject:vc.presentedViewController];
- vc = vc.presentedViewController;
- }else{
- break;
- }
- }
- [self dismissViewControllerAnimated:NO completion:^{}];
- }
-
- }
- - (NSMutableArray<UIViewController *> *)presentedVCs{
- return objc_getAssociatedObject(self, PresentedVCsKey);
- }
- - (void)setPresentedVCs:(NSMutableArray<UIViewController *> *)presentedVCs{
- objc_setAssociatedObject(self, PresentedVCsKey, presentedVCs, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
- }
- @end
|