ios 不通过import 调用其他控制器的方法

ios 开发过程中在不通过import 调用其他类的方法

//获取类名

Class controller = NSClassFromString(@"controller");

  //不允许为空

    if (controller) {

        //是否实现了该方法

        if ([[controller alloc] respondsToSelector:@selector(method)]) {

            

            id wbc = [[controller alloc] performSelector:@selector(method)];

            //添加到当前的window

            [[[[UIApplication sharedApplication] keyWindow] rootViewController] presentViewController:wbc animated:YES completion:^{

                

            }];

        }

 

    }

 

 

原文地址:https://www.cnblogs.com/Xujg/p/5345366.html