Latest 0.0.4
Homepage https://github.com/yanmin7857/XYKitDemo
License MIT
Platforms ios , requires ARC
Dependencies MGJRouter
Authors

XYKit 基础分类收集

可支持pod

Pod ‘XY_Kit’

集成蘑菇街 MGJRouter 封装UIViewController+XYVC.h分类

页面跳转再也不需要引入文件啦!

/** 找到当前视图控制器 */
+ (UIViewController *)wh_currentViewController;

/** 找到当前导航控制器 */
+ (UINavigationController *)wh_currentNavigatonController;

/** 在当前视图控制器中添加子控制器,将子控制器的视图添加到view中 */
- (void)wh_addChildController:(UIViewController *)childController intoView:(UIView *)view;

/**
* push跳转页面
* @param name 类名
* @param param 参数
* @param completion block反向回调
*/
- (void)pushController:(NSString *)name params:(NSDictionary *)param completion:(void (^)(id result))completion;

/**
* 模态跳转页面
* @param name 类名
* @param param 参数
* @param completion block反向回调
*/
- (void)presentController:(NSString *)name params:(NSDictionary *)param completion:(void (^)(id result))completion;

/**
* block回调
*/
@property (nonatomic,copy) void(^completion)(id result);

/**
* 参数
*/
@property (nonatomic,strong) NSDictionary *param;

使用方法

// 控制器中使用
//    //可反向传值
//    [self pushController:@"ViewController1" params:nil completion:^(id result) {
//        NSLog(@"路由能回调了 %@",result);
//    }];

//传参跳转
[self pushController:@"ViewController1" params:@{@"11":@"123",@"22":@{@"333":@"skfs"}} completion:nil];

//    //模态跳转
//    [self presentController:@"ViewController1" params:@{@"11":@"123",@"22":@{@"333":@"skfs"}} completion:^(id result) {
//        NSLog(@"路由能回调了 %@",result);
//    }];

//    //模态跳转
//    [self presentController:@"ViewController1" params:@{@"11":@"123",@"22":@{@"333":@"skfs"}} completion:nil];

// ViewController1使用

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor whiteColor];
NSLog(@"参数%@", self.param);
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
//需要回调时使用
self.completion(@"gg");
}

Latest podspec

{
    "name": "XY_Kit",
    "version": "0.0.4",
    "summary": "u57fau7840u5206u7c7bu53cau8defu7531u5206u7c7b",
    "description": "u57fau7840u5206u7c7bu53cau8defu7531u5206u7c7b u9875u9762u8df3u8f6cu518du4e5fu4e0du9700u8981u5f15u5165u6587u4ef6u5566uff01",
    "homepage": "https://github.com/yanmin7857/XYKitDemo",
    "license": "MIT",
    "authors": {
        "XY_Kit": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yanmin7857/XYKitDemo.git",
        "tag": "0.0.4"
    },
    "source_files": [
        "Classes",
        "XYKit/**/*.{h,m}"
    ],
    "exclude_files": "Classes/Exclude",
    "requires_arc": true,
    "platforms": {
        "ios": null
    },
    "dependencies": {
        "MGJRouter": []
    },
    "prefix_header_contents": "#import "MGJRouter.h""
}

Pin It on Pinterest

Share This