用Storyboard實例化控制器:-創(chuàng)新互聯(lián)

步驟一:手動初始化storyboard.

成都創(chuàng)新互聯(lián)堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站制作、網(wǎng)站設(shè)計、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的駐馬店網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
  1. 首先刪除系統(tǒng)自動創(chuàng)建的ViewController.h, ViewController.m 和 main.storyboard這三個文件。

  2.  點擊項目——>General——>Deployment Info,在Main Interface選項中將main刪除。

  3.   新建一個Storyboard文件,拖一個控制器,在拖一個按鈕。點擊storyboard上方的導(dǎo)航條,在右側(cè)“屬性”欄下view Controller復(fù)選框中Title下方將“Is Initial View Controller”勾選上。

  4.   在AppDelegate.m文件中的didFinishLaunchingWithOptions方法中填寫下面代碼:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

//  1. Create a window

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

//  2. Create Controller(A StoryBoard)

  UIStoryboard *story = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];

//  2.1 Instantiate Controller (With Sweet(jian tou))

  UIViewController *vc = [story instantiateInitialViewController];

//  3. Set the window Root Controller

  self.window.rootViewController = vc;

//  4. Put the window as the Main Window and visible

  [self.window makeKeyAndVisible];

  return YES;

}

步驟二:通過標(biāo)記初始化storyboard。

  1. 首先刪除系統(tǒng)自動創(chuàng)建的ViewController.h, ViewController.m 和 main.storyboard這三個文件。

   2.  點擊項目——>General——>Deployment Info,在Main Interface選項中將main刪除。

  3.   新建一個Storyboard文件,拖一個控制器,在拖一個按鈕。點擊storyboard上方的導(dǎo)航條,在右側(cè)“屬性”欄左側(cè)選項中identity選項下storyboard ID里填寫“Vstar”,之后點擊回車鍵。

  4.   在AppDelegate.m文件中的didFinishLaunchingWithOptions方法中填寫下面代碼:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

//  1. Create a window

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

//  2. Create Controller(A StoryBoard)

  UIStoryboard *story = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];

//  2.1 Instantiate Controller (With Sweet(jian tou))

  UIViewController *vc = [story instantiateViewControllerWithIdentifier:@"Vstar"];

//  3. Set the window Root Controller

  self.window.rootViewController = vc;

//  4. Put the window as the Main Window and visible

  [self.window makeKeyAndVisible];

  return YES;

}

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

網(wǎng)站題目:用Storyboard實例化控制器:-創(chuàng)新互聯(lián)
當(dāng)前URL:http://bm7419.com/article32/ddhgpc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)、建站公司關(guān)鍵詞優(yōu)化、移動網(wǎng)站建設(shè)、定制開發(fā)外貿(mào)網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運營