feat:iOS demo list
This commit is contained in:
parent
3426fcd102
commit
4fdc37a717
@ -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];
|
||||
|
@ -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];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user