feat:iOS demo list
This commit is contained in:
parent
3426fcd102
commit
4fdc37a717
@ -25,7 +25,11 @@ - (instancetype)initWithPath:(NSString *)filePath {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (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 = [[DoricContext alloc] initWithScript:jsContent source:self.filePath];
|
||||||
[self.doricContext.rootNode setupRootView:[[DoricStackView new] also:^(DoricStackView *it) {
|
[self.doricContext.rootNode setupRootView:[[DoricStackView new] also:^(DoricStackView *it) {
|
||||||
it.backgroundColor = [UIColor whiteColor];
|
it.backgroundColor = [UIColor whiteColor];
|
||||||
@ -34,6 +38,7 @@ - (void)viewDidLoad {
|
|||||||
height:DoricLayoutAtMost
|
height:DoricLayoutAtMost
|
||||||
margin:DoricMarginMake(0, 88, 0, 0)
|
margin:DoricMarginMake(0, 88, 0, 0)
|
||||||
];
|
];
|
||||||
|
it.top = 88;
|
||||||
[self.view addSubview:it];
|
[self.view addSubview:it];
|
||||||
}]];
|
}]];
|
||||||
[self.doricContext initContextWithWidth:self.view.width height:self.view.height];
|
[self.doricContext initContextWithWidth:self.view.width height:self.view.height];
|
||||||
|
@ -18,6 +18,7 @@ @implementation ViewController
|
|||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
self.title = @"Doric Demo";
|
||||||
NSString *path = [[NSBundle mainBundle] bundlePath];
|
NSString *path = [[NSBundle mainBundle] bundlePath];
|
||||||
NSString *demoPath = [path stringByAppendingPathComponent:@"demo"];
|
NSString *demoPath = [path stringByAppendingPathComponent:@"demo"];
|
||||||
NSFileManager *mgr = [NSFileManager defaultManager];
|
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||||
@ -49,10 +50,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
NSString *path = [[NSBundle mainBundle] bundlePath];
|
DemoVC *demoVC = [[DemoVC alloc] initWithPath:self.demoFilePaths[(NSUInteger) indexPath.row]];
|
||||||
NSString *demoPath = [path stringByAppendingPathComponent:@"demo"];
|
|
||||||
NSString *fullPath = [demoPath stringByAppendingPathComponent:self.demoFilePaths[(NSUInteger) indexPath.row]];
|
|
||||||
DemoVC *demoVC = [[DemoVC alloc] initWithPath:fullPath];
|
|
||||||
[self.navigationController pushViewController:demoVC animated:NO];
|
[self.navigationController pushViewController:demoVC animated:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user