當前位置:首頁 » 數字幣問答 » 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文件是在蘋果開發者中心獲得的。

熱點內容
國內雲算力平台 發布:2025-09-14 22:38:05 瀏覽:265
如何山寨比特幣 發布:2025-09-14 22:36:23 瀏覽:783
怎麼買到區塊鏈 發布:2025-09-14 22:31:22 瀏覽:442
我的比特幣賬戶嗎 發布:2025-09-14 22:31:19 瀏覽:512
螞蟻礦機閃紅燈 發布:2025-09-14 22:26:37 瀏覽:85
shib怎麼還不起飛 發布:2025-09-14 22:06:32 瀏覽:773
螞蟻s7礦機好嗎 發布:2025-09-14 21:54:29 瀏覽:248
1080ti挖eth51 發布:2025-09-14 21:54:26 瀏覽:381
以太礦機算力計算器 發布:2025-09-14 21:54:17 瀏覽:814
區塊鏈集資APP 發布:2025-09-14 21:53:20 瀏覽:270