1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// UIViewController+StoryBoard.m
// Patrol
//
// Created by 曹云霄 on 2017/7/20.
// Copyright © 2017年 上海勾芒科技信息有限公司. All rights reserved.
//
#import "UIViewController+StoryBoard.h"
@implementation UIViewController (StoryBoard)
+ (instancetype)viewControllerWithStoryBoardType:(STORYBOARD_TYPE_)type {
NSString *identifier = NSStringFromClass(self);
UIStoryboard *storyboard;
switch (type) {
case STORYBOARD_TYPE_MAIN: {
storyboard = [UIStoryboard storyboardWithName:@"OppleMain" bundle:nil];
break;
}
case STORYBOARD_TYPE_ANNOUNCEMENT: {
storyboard = [UIStoryboard storyboardWithName:@"Announcement" bundle:nil];
break;
}
case STORYBOARD_TYPE_GUIDEINTERGRAL: {
storyboard = [UIStoryboard storyboardWithName:@"GuideIntegral" bundle:nil];
break;
}
case STORYBOARD_TYPE_LEARNINGCENTER: {
storyboard = [UIStoryboard storyboardWithName:@"LearningCenter" bundle:nil];
break;
}
case STORYBOARD_TYPE_USER: {
storyboard = [UIStoryboard storyboardWithName:@"UserStoryboard" bundle:nil];
break;
}
}
return [storyboard instantiateViewControllerWithIdentifier:identifier];
}
@end