国产亚洲欧美人成在线,免费视频爱爱太爽了无码,日本免费一区二区三区高清视频 ,国产真实伦对白精彩视频

歡迎您光臨深圳塔燈網(wǎng)絡(luò)科技有限公司!
電話圖標(biāo) 余先生:13699882642

網(wǎng)站百科

為您解碼網(wǎng)站建設(shè)的點(diǎn)點(diǎn)滴滴

iOS 項(xiàng)目集成Flutter

發(fā)表日期:2018-11 文章編輯:小燈 瀏覽次數(shù):1894

最近移動(dòng)端火爆無(wú)非是Flutter--舍我其誰(shuí),而官網(wǎng)的引導(dǎo)之中鮮有說怎么在已有項(xiàng)目中去集成Flutter,今天我們就再蹭個(gè)熱門來(lái)進(jìn)行一個(gè)iOS集成

1 創(chuàng)建iOS項(xiàng)目(做測(cè)試使用)
2 cocoapods走起

project 'XX.xcodeproj' #source 'https://github.com/CocoaPods/Specs.git' #platform :ios, '9.0' #inhibit_all_warnings! # Uncomment the next line to define a global platform for your project # platform :ios, '9.0'target 'XX' do # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks!# Pods for XXtarget 'XXTests' do inherit! :search_paths # Pods for testing endtarget 'XXUITests' do inherit! :search_paths # Pods for testing endend flutter_application_path = './flutter_module' eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding) 

關(guān)鍵部鋒分就是末尾添加的

flutter_application_path = './flutter_module' eval(File.read(File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')), binding) 

3 進(jìn)入項(xiàng)目根目錄添加flutter_module

flutter create -t module flutter_module 

4 Xcode 設(shè)置
Build Phases 添加 Run Scripts

"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build 

4 pod install

5 code設(shè)置
5.1 Appdelegate

#import <Flutter/Flutter.h> @interface AppDelegate : FlutterAppDelegate//@property (strong, nonatomic) UIWindow *window; @end 
#import <FlutterPluginRegistrant/GeneratedPluginRegistrant.h> // Only if you have Flutter Plugins- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. [GeneratedPluginRegistrant registerWithRegistry:self]; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } 

5.2 Controller切換

 - (IBAction)pushFlutterVC:(id)sender { FlutterViewController *flutterViewController = [[FlutterViewController alloc] init]; flutterViewController.view.backgroundColor = [UIColor cyanColor]; [flutterViewController setInitialRoute:@"route1"];[self presentViewController:flutterViewControlleranimated:YES completion:^{UIViewController * vc = [[NextViewController alloc] init]; // vc.view.backgroundColor = [UIColor whiteColor];AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;UIViewController * rootVC = appDelegate.window.rootViewController;UIViewController * topVC = nil;if ([rootVC isKindOfClass:[UINavigationController class]]) { topVC =((UINavigationController *)rootVC).topViewController.presentedViewController;} else {topVC =rootVC.presentedViewController;}[topVC presentViewController:vc animated:YES completion:nil];}]; } 

5.2中我們要考慮到首頁(yè)是Nav UIViewCOntrooler 或者是FlutterViewController
到此我們的就可以直接Xcode run運(yùn)行項(xiàng)目啦

6 假如想實(shí)現(xiàn)hot reload

進(jìn)入項(xiàng)目中的flutter_module,運(yùn)行 flutter attach 
熱更新
本頁(yè)內(nèi)容由塔燈網(wǎng)絡(luò)科技有限公司通過網(wǎng)絡(luò)收集編輯所得,所有資料僅供用戶學(xué)習(xí)參考,本站不擁有所有權(quán),如您認(rèn)為本網(wǎng)頁(yè)中由涉嫌抄襲的內(nèi)容,請(qǐng)及時(shí)與我們聯(lián)系,并提供相關(guān)證據(jù),工作人員會(huì)在5工作日內(nèi)聯(lián)系您,一經(jīng)查實(shí),本站立刻刪除侵權(quán)內(nèi)容。本文鏈接:http://m.jstctz.cn/17534.html
相關(guān)APP開發(fā)