美文网首页
OC: UIStoryboard+MaxMethod

OC: UIStoryboard+MaxMethod

作者: 一欧Yiou | 来源:发表于2018-11-06 14:06 被阅读7次

.h文件

#import <UIKit/UIKit.h>

@interface UIStoryboard (MaxMethod)

+ (UIStoryboard *)loadWithName:(NSString *)name;
+ (UIViewController *)loadViewController:(Class)viewController;

@end

.m文件

#import "UIStoryboard+MaxMethod.h"

@implementation UIStoryboard (MaxMethod)

+ (UIStoryboard *)loadWithName:(NSString *)name {
    return [UIStoryboard storyboardWithName:name bundle:[NSBundle mainBundle]];
}

+ (UIViewController *)loadViewController:(Class)viewController {
    return [[UIStoryboard loadWithName:@"Main"] instantiateViewControllerWithIdentifier:NSStringFromClass(viewController)];
}

@end

相关文章

网友评论

      本文标题:OC: UIStoryboard+MaxMethod

      本文链接:https://www.haomeiwen.com/subject/vihuxqtx.html