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/doric-iOS/Example/Example/DemoVC.m
osborn 25ba991893
Feature/prepare publish (#2)
* add doric-js bundle into vcs

* android project read js bundle directly

* update iOS project config

* update version
2019-12-23 15:29:38 +08:00

40 lines
1.1 KiB
Objective-C

//
// Created by pengfei.zhou on 2019/11/19.
// Copyright (c) 2019 pengfei.zhou. All rights reserved.
//
#import "DemoVC.h"
#import <DoricCore/Doric.h>
@interface DemoVC ()
@property(nonatomic, copy) NSString *filePath;
@end
@implementation DemoVC
- (instancetype)initWithPath:(NSString *)filePath {
if (self = [self init]) {
_filePath = filePath;
}
return self;
}
- (void)viewDidLoad {
self.title = self.filePath;
self.view.backgroundColor = [UIColor whiteColor];
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *demoPath = [path stringByAppendingPathComponent:@"src"];
NSString *fullPath = [demoPath stringByAppendingPathComponent:self.filePath];
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:self.filePath extra:nil];
}
@end