當前位置:首頁 » 數字幣問答 » 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-05-16 00:37:59 瀏覽:566
區塊鏈技術與短視頻相結合 發布:2025-05-16 00:27:07 瀏覽:327
幣圈搬磚利器 發布:2025-05-16 00:26:59 瀏覽:809
btc為什麼一文不值 發布:2025-05-16 00:09:07 瀏覽:155
百度智能雲區塊鏈產品負責人 發布:2025-05-15 23:10:48 瀏覽:573
數字貨幣先交稅後提現 發布:2025-05-15 23:05:50 瀏覽:310
1066以太坊算力 發布:2025-05-15 22:50:37 瀏覽:618
比特幣糖果可以長期持有嗎 發布:2025-05-15 22:42:21 瀏覽:563
礦機維修技巧 發布:2025-05-15 22:37:42 瀏覽:264
幣圈虧損經歷 發布:2025-05-15 22:30:53 瀏覽:150