xcode11鏂伴」鐩垹闄ain.storyboard 涓ょ鏂规硶

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xcode11鏂伴」鐩垹闄ain.storyboard 涓ょ鏂规硶相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/not_2_run' title='not run'>not run   load   鍥剧墖   OLE   浣跨敤   file   鑷繁   files   initial   

鏂规硶涓€

蹇冩€ョ殑绔ラ瀷鎸夌収鑰佹搷浣滃畬鎴愬悗鍐嶆寜鐓у涓嬫搷浣滃嵆鍙?/strong>

 

/**
 寮冪敤storboard
 1銆乮nfo.plist鍘婚櫎
 <key>UIApplicationSceneManifest</key>
 <dict>
     <key>UIApplicationSupportsMultipleScenes</key>
     <false/>
     <key>UISceneConfigurations</key>
     <dict>
         <key>UIWindowSceneSessionRoleApplication</key>
         <array>
             <dict>
                 <key>UISceneConfigurationName</key>
                 <string>Default Configuration</string>
                 <key>UISceneDelegateClassName</key>
                 <string>SceneDelegate</string>
                 <key>UISceneStoryboardFile</key>
                 <string>Main</string>
             </dict>
         </array>
     </dict>
 </dict>
 2銆佸惎鍔ㄩ〉娉ㄩ噴
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
    // Called when a new scene session is being created.
    // Use this method to select a configuration to create the new scene with.
    return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}


- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
    // Called when the user discards a scene session.
    // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
    // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
 */

 

 

鍏蜂綋濡備笅锛?/strong>

鐢▁code11鏂板缓iOS椤圭洰鍚庯紝鎯宠鍒犻櫎榛樿鐨刴ain.storyboard锛屼娇鐢ㄨ嚜瀹氫箟鐨剋indow鍜宑ontroller鐨勫潙銆?/p>

鍏锋湁涓€瀹氱粡楠岀殑浜烘兂蹇呴兘鐭ラ亾Xcode11涔嬪墠锛屾兂瑕佽揪鍒颁笂闈㈢殑鐩殑姝ラ鍚с€傞鍏堝氨鏄€変腑宸ョ▼鏂囦欢閫夐」锛屼箣鍚庡垹闄ain Interface閫夐」閲岀殑Main锛屽涓嬪浘锛?/p>

 鎶€鏈浘鐗? src=

 
鎶€鏈浘鐗?  data-original-src=
 

涔嬪悗鍦ˋppdelegate鐨刣idFinishLaunchingWithOptions鏂规硶涓嚜瀹氫箟window骞惰缃负keyWindow鍜岃瀹冩樉绀猴紝濡備笅鍥?

 鎶€鏈浘鐗? src=
鎶€鏈浘鐗?  data-original-src=
 

灏辫繖涔堢畝鍗曠殑瀹炵幇浜嗐€?/p>

鐒堕箙闅忕潃ios13鐨勬帹鍑猴紝鍦ㄤ箣鍓岮ppDelegate鐨勫熀纭€涓婂鍑轰簡涓€涓猄ceneDelegate锛屼細灏咥ppDelegate閲岀殑lifecycle鐨勯偅浜涗唬鐞嗘柟娉曡浆浜ょ粰SceneDelegate锛屽氨鏄€氳繃AppDelegate閲屼互涓嬩袱涓柟娉曞疄鐜扮殑

 

 鎶€鏈浘鐗? src=
鎶€鏈浘鐗?  data-original-src=
 

浠ヤ笅鐨勫唴瀹规槸鎽樿嚜鑻规灉瀹樻柟鏂囨。锛?/p>

Overview

A UISceneSession object manages a unique runtime instance of your scene. When the user adds a new scene to your app, or when you request one programmatically, the system creates a session object to track that scene. The session contains a unique identifier and the configuration details of the scene. UIKit maintains the session information for the lifetime of the scene itself, destroying the session in response to the user closing the scene in the app switcher. 

You do not create session objects directly. UIKit creates sessions in response to user interactions with your app. You can also ask UIKit to create a new scene and session programmatically by calling the requestSceneSessionActivation:userActivity:options:errorHandler: method of UIApplication. UIKit initializes the session with default configuration data based on the contents of your app鈥榮 Info.plist file.

澶ф鎰忔€濆氨鏄紝涓€涓猆ISceneSession涓嶇敤浣犵洿鎺ュ幓鍒涘缓瀵硅薄锛屼綘鍙互鐢║IApplication閲岀殑requestSceneSessionActivation:userActivity:options:errorHandler:鏂规硶锛岃繖涓柟娉曚細甯綘鍒濆鍖栦竴涓熀浜巌nfo.plist鏂囦欢閲岀殑榛樿configuration鐨剆ession瀵硅薄銆?/p>

 

 

 

鍥犳xcode11涓瀹炵幇鑷繁鐨勬病鏈夐粯璁ain.storyboard鐨勯」鐩紝灏卞緱灏哠ceneDelegate閲岀殑lifecycle杞氦缁橝ppDelegate锛屾寜鐓т笂闈㈡墍璇达紝杩欎竴姝ユ搷浣滃氨鏄紝鍒犻櫎鎴栨敞閲婁竴涓嬫埅鍥鹃噷鐨勪袱涓柟娉?/p>

 鎶€鏈浘鐗? src=
鎶€鏈浘鐗?  data-original-src=
 

鎺ヨ繎鐫€鍒犻櫎鍦╥nfo.plist閲岀殑Application Scene Manifest鏉$洰

 鎶€鏈浘鐗? src=
鎶€鏈浘鐗?  data-original-src=
 

涔嬪悗灏辨槸xcode11浠ュ墠鐨勫父瑙勬搷浣滀簡锛岄鍏堬紝鍒犻櫎info.plist閲岀殑Main storyboard file base name鏉$洰

 
鎶€鏈浘鐗?  data-original-src=
 鎶€鏈浘鐗? src=

涔嬪悗鍦ˋppDelegate.swift閲屾坊鍔爓indow灞炴€э紝鍥犱负xcode榛樿鍒犻櫎浜嗚繖涓睘鎬э紝鐜板湪浣犻渶瑕佸皢瀹冮噸鏂版坊鍔犲洖鏉ユ墠琛岋紝濡傛灉鏄疧C鍐欑殑璇濓紝灏卞湪AppDelegate.h閲屾坊鍔犺繖涓獁indow灞炴€с€?/p>

 鎶€鏈浘鐗? src=
鎶€鏈浘鐗?  data-original-src=
 

涔嬪悗灏卞湪didFinishLaunch鏂规硶閲屽垵濮嬪寲self.window锛屽苟璁剧疆涓簁eywindow鍜岃瀹冩樉绀猴紝骞跺垵濮嬪寲榛樿鎺у埗鍣ㄥ嵆鍙€?/p>

 鏂规硶浜?/strong>
鎶€鏈浘鐗?  data-original-src=
Xcode鑷姩鏂板浜嗕竴涓猄ceneDelegate鏂囦欢锛?涔熷氨鏄鍦╥OS13涓瑼ppdelegate鐨勪綔鐢ㄥ彂鐢熶簡鏀瑰彉: iOS13涔嬪墠锛孉ppdelegate鐨勪綔鐢ㄦ槸鍏ㄦ潈澶勭悊App鐢熷懡鍛ㄦ湡鍜孶I鐢熷懡鍛ㄦ湡锛?iOS13涔嬪悗锛孉ppdelegate鐨勪綔鐢ㄦ槸鍙鐞?App 鐢熷懡鍛ㄦ湡, 鑰孶I鐨勭敓鍛藉懆鏈熷皢鍏ㄦ潈鐢辨柊澧炵殑SceneDelegate鏉ュ鐞?
 
SceneDelegate.m涓殑鏂规硶鍙湁iOS13涔嬪悗鎵嶈兘浣跨敤, 濡傛灉鏂板缓鐨勯」鐩鍏煎涔嬪墠鐨勭増鏈? 灏遍渶瑕佽嚜宸卞湪SceneDelegate鍜孉ppdelegate涓仛鍒ゆ柇
 

棣栧厛, UI鐩稿叧鐨勫凡缁忎笉鑳藉彧鏀惧湪Appdelegate涓? 鑰屾槸鍖哄垎绯荤粺鏀惧湪SceneDelegate涓鐞?

鍏舵, 瑕佸湪Info.plist涓垹闄ゅ搴旂殑璺緞.

鎶€鏈浘鐗? src=

 

鏈€鍚? 鍦⊿ceneDelegate.m涓坊鍔犳牴鎺у埗鍣?/p>

- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
    // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
    // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
    // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
    
    self.window = [[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene];
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    UIViewController *rootVc = [[UIViewController alloc]init];
    rootVc.view.backgroundColor = [UIColor purpleColor];
    UINavigationController *rootNav = [[UINavigationController alloc]initWithRootViewController:rootVc];
    [self.window setRootViewController:rootNav];
    [self.window makeKeyAndVisible];
}

 





以上是关于xcode11鏂伴」鐩垹闄ain.storyboard 涓ょ鏂规硶的主要内容,如果未能解决你的问题,请参考以下文章

婧愮爜鍒嗘瀽涔?--HashMap鏌ユ壘銆佸垹闄ゃ€侀亶鍘?/h1>

娆ц礉OBetChat鎸栫熆

鑾峰彇cookie锛岃缃甤ookie锛屽垹闄ookie

鏂伴椈鐧诲綍椤甸潰鍒朵綔

mysql 瑙﹀彂鍣ㄥ疄鐜扮骇鑱斿垹闄ゆ湁澶栭敭鐨勫寮犺〃

(c)2006-2024 SYSTEM All Rights Reserved IT常识