當前位置:首頁 » 數字幣問答 » wexcode數字貨幣

wexcode數字貨幣

發布時間: 2021-05-22 14:41:02

Ⅰ weex 在ios怎麼調用.we文件

項目初始化1、沒有現成的工程的話新建ios項目命令行cd到項目根目錄 執行 pod init,會創建一個pod配置文件用編輯器打開,加上 pod 'WeexSDK', :path=>'./sdk/'

/weex在ios目錄下有個sdk文件夾,把它復制到ios項目根目錄,和podFile里配置的路徑一致關掉xcode,在當前目錄,命令行執行pod install,現在項目目錄變成了這樣,以後點擊xcworkspace文件打開項目創建一個新目錄weex,命令行cd到weex目錄,執行weex init,會提示你輸入項目名稱自動創建的文件:

在當前目錄命令行執行npm install,安裝依賴庫創建一個文件夾js,命令行執行weex src -o js生成最終需要的js文件也可以weex src/main.we在瀏覽器預覽或者weex src/main.we --qr 生成二維碼,用playground App 掃描預覽載入weex頁面xcode打開workspace項目文件打開AppDelegate.m添加一下內容將之前創建的js文件夾拖到xcode工程的文件列表效果是這樣的weex視圖控制器的初始化ViewController.h:

[objc] view plain 在CODE上查看代碼片派生到我的代碼片//// ViewController.h// weexDemo3//// Created by admin on 16/8/3.

// Copyright ? 2016年 admin. All rights reserved.

//#import <UIKit/UIKit.h>

@interface ViewController : UIViewController- (instancetype)initWithJs:(NSString *)filePath;@endViewController.m:

[objc] view plain 在CODE上查看代碼片派生到我的代碼片//// ViewController.m// weexDemo3//// Created by admin on 16/8/3.

// Copyright ? 2016年 admin. All rights reserved.

//#import "ViewController.h"#import <WeexSDK/WXSDKInstance.h>

@interface ViewController ()@property (nonatomic, strong) WXSDKInstance *instance;@property (nonatomic, strong) UIView *weexView;@end@implementation ViewController{NSURL *jsUrl;}

- (instancetype)initWithJs:(NSString *)filePath{self = [super init];if (self) {//遠程js文件// NSString *path=[NSString stringWithFormat:@"http://192.168.232.13:8080/examples/js/%@",filePath];//本地js文件NSString *path=[NSString stringWithFormat:@"file://%@/js/%@",[NSBundle mainBundle].bundlePath,filePath];NSLog(@"-----path:%@",path);jsUrl=[NSURL URLWithString:path];}

return self;}

- (void)viewDidLoad {[super viewDidLoad];_instance = [[WXSDKInstance alloc] init];_instance.viewController = self;_instance.frame=self.view.frame;__weak typeof(self) weakSelf = self;_instance.onCreate = ^(UIView *view) {[weakSelf.weexView removeFromSuperview];weakSelf.weexView = view;[weakSelf.view addSubview:weakSelf.weexView];};_instance.onFailed = ^(NSError *error) {NSLog(@"載入錯誤");};_instance.renderFinish = ^ (UIView *view) {NSLog(@"載入完成");};if (!jsUrl) {return;}

[_instance renderWithURL: jsUrl];self.view.backgroundColor=[UIColor whiteColor];}

- (void)didReceiveMemoryWarning {[super didReceiveMemoryWarning];// Dispose of any resources that can be recreated.

}

- (void)dealloc{[_instance destroyInstance];}

@end再打開AppDelegate成都軟體開發公司http://www.yingtaow.com?chidcd創建導航控制器引入頭文件#import "ViewController.h"創建導航視圖:

[objc] view plain 在CODE上查看代碼片派生到我的代碼片- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {//weex[self initWeex];ViewController *vc=[[ViewController alloc]initWithJs:@"main.js"];UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:vc];self.window.rootViewController=nav;return YES;}

運行圖片不顯示是因為圖片載入需要自己創建模塊,可以直接把demo的代碼和pod配置粘過來使用

Ⅱ Xcode里怎麼使用c 調用oc的方法

1.你的文件不能只是C類型的。下面我選擇的類型是Foundation類型。

Ⅲ wex5打包ios需要設置xcode嗎

私鑰和profile文件 需要擁有蘋果電腦,在獲得證書以後導出證書時會要求你填寫私鑰密碼,profile文件是在蘋果開發者中心獲得的。

熱點內容
btc有什 發布:2025-07-12 15:13:25 瀏覽:214
區塊鏈任務賺錢的app正規嗎 發布:2025-07-12 15:12:32 瀏覽:724
萊特幣礦機放屋裡能行嗎 發布:2025-07-12 15:06:17 瀏覽:485
eth和zec能雙挖嗎 發布:2025-07-12 14:59:29 瀏覽:423
usdt一直下降 發布:2025-07-12 14:56:54 瀏覽:175
各國對區塊鏈資產的態度如何 發布:2025-07-12 14:55:47 瀏覽:77
幣圈寒冬還有多少年 發布:2025-07-12 14:55:46 瀏覽:119
sc礦機難度 發布:2025-07-12 14:55:38 瀏覽:585
eth礦池國外 發布:2025-07-12 14:44:42 瀏覽:175
幣圈的五大常見問題 發布:2025-07-12 14:44:35 瀏覽:39