This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/target/iOS/Example/ViewController.m

38 lines
1.0 KiB
Mathematica
Raw Normal View History

2019-12-05 21:15:16 +08:00
//
// ViewController.m
// Example
//
// Created by pengfei.zhou on 2019/12/5.
// Copyright © 2019 pengfei.zhou. All rights reserved.
//
#import "ViewController.h"
#import <Doric/Doric.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
NSString *bundleName = @"__$__";
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *demoPath = [path stringByAppendingPathComponent:@"src"];
NSString *fullPath = [demoPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.js",bundleName]];
NSString *jsContent = [NSString stringWithContentsOfFile:fullPath encoding:NSUTF8StringEncoding error:nil];
DoricPanel *panel = [DoricPanel new];
[panel.view also:^(UIView *it) {
it.width = self.view.width;
it.height = self.view.height - 88;
it.top = 88;
[self.view addSubview:it];
}];
[self addChildViewController:panel];
[panel config:jsContent alias:bundleName];
}
@end