| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- //
- // FrameRoot.m
- // iShop
- //
- // Created by Rui Zhang on 12/14/23.
- //
- #import "FrameRoot.h"
- @interface FrameRoot ()
- @end
- @implementation FrameRoot
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
-
- NSArray* tabjson =(NSArray*) [self dictionaryFileName:@"tab.json"];
-
-
- NSMutableArray* tab = [NSMutableArray new];
- for(int i=0;i<tabjson.count;i++)
- {
- NSDictionary* item = tabjson[i];
- UIViewController* vc = [[UIStoryboard storyboardWithName:@"Frame" bundle:nil] instantiateViewControllerWithIdentifier:item[@"Identifier"]];
-
- UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:vc] ;
-
- [tab addObject:navi];
- // Class class =NSClassFromString(item[@"class"]);
- // [[class alloc] initWithNibName:@"" bundle:nil];
- }
-
- self.viewControllers = tab;
-
-
- }
- - (NSMutableDictionary *)dictionaryFileName:(NSString *)name {
- NSString *path = [[NSBundle mainBundle] pathForResource:name ofType:nil];
- NSData *data = [NSData dataWithContentsOfFile:path];
- NSMutableDictionary *ret = [[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil] mutableCopy];
-
- return ret;
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|