diff --git a/iOS/Example/Example/DemoVC.m b/iOS/Example/Example/DemoVC.m index 62f687f6..2c142ac6 100644 --- a/iOS/Example/Example/DemoVC.m +++ b/iOS/Example/Example/DemoVC.m @@ -25,7 +25,11 @@ - (instancetype)initWithPath:(NSString *)filePath { } - (void)viewDidLoad { - NSString *jsContent = [NSString stringWithContentsOfFile:self.filePath encoding:NSUTF8StringEncoding error:nil]; + self.title = self.filePath; + NSString *path = [[NSBundle mainBundle] bundlePath]; + NSString *demoPath = [path stringByAppendingPathComponent:@"demo"]; + NSString *fullPath = [demoPath stringByAppendingPathComponent:self.filePath]; + NSString *jsContent = [NSString stringWithContentsOfFile:fullPath encoding:NSUTF8StringEncoding error:nil]; self.doricContext = [[DoricContext alloc] initWithScript:jsContent source:self.filePath]; [self.doricContext.rootNode setupRootView:[[DoricStackView new] also:^(DoricStackView *it) { it.backgroundColor = [UIColor whiteColor]; @@ -34,6 +38,7 @@ - (void)viewDidLoad { height:DoricLayoutAtMost margin:DoricMarginMake(0, 88, 0, 0) ]; + it.top = 88; [self.view addSubview:it]; }]]; [self.doricContext initContextWithWidth:self.view.width height:self.view.height]; diff --git a/iOS/Example/Example/ViewController.m b/iOS/Example/Example/ViewController.m index 7e0d5185..27231476 100644 --- a/iOS/Example/Example/ViewController.m +++ b/iOS/Example/Example/ViewController.m @@ -18,6 +18,7 @@ @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; + self.title = @"Doric Demo"; NSString *path = [[NSBundle mainBundle] bundlePath]; NSString *demoPath = [path stringByAppendingPathComponent:@"demo"]; NSFileManager *mgr = [NSFileManager defaultManager]; @@ -49,10 +50,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSString *path = [[NSBundle mainBundle] bundlePath]; - NSString *demoPath = [path stringByAppendingPathComponent:@"demo"]; - NSString *fullPath = [demoPath stringByAppendingPathComponent:self.demoFilePaths[(NSUInteger) indexPath.row]]; - DemoVC *demoVC = [[DemoVC alloc] initWithPath:fullPath]; + DemoVC *demoVC = [[DemoVC alloc] initWithPath:self.demoFilePaths[(NSUInteger) indexPath.row]]; [self.navigationController pushViewController:demoVC animated:NO]; }