PSRouter 是实现控制器之间滑动过渡的好方法,适合 MVVM。您不需要导入控制器头文件,只需在 AppDelegate 中注册即可。
target 'TargetName' do
pod 'PSRouter'
end
[[PSRouter shareInstance] registerClass:[ViewController class] protocol:@protocol(protocol)];
您应该使用协议来传递参数
@protocol protocol<NSObject>
@property (nonatomic, strong) id para;
、、、
@end
注册的控制器应遵循在 PSRouter 中注册的协议
@interface ViewController ()<protocol>
@end
@implementation ViewController
@synthesize para = _para;
@end
将 YES 传递给 isModel 以指定显示样式
[[PSRouter shareInstance] openScheme:<#(nonnull Protocol *)#> property:<#^(id _Nullable x)property#> isModel:<#(BOOL)#>]
默认为推送样式
[[PSRouter shareInstance] openScheme:@protocol(protocol) property:^(id<protocol>target) {
target.buttonTitle = @"Sectond";
}];