第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

導(dǎo)航控制器推式視圖控制器

導(dǎo)航控制器推式視圖控制器

Go
UYOU 2019-12-15 16:12:42
題如何僅使用按鈕的touch up內(nèi)部事件從一個(gè)視圖控制器導(dǎo)航到另一個(gè)視圖控制器?更多信息我在一個(gè)示例項(xiàng)目中嘗試執(zhí)行的步驟是:創(chuàng)建示例單視圖應(yīng)用程序。為用戶界面(ViewController2)添加一個(gè)新文件->具有XIB的Objective-C類。在ViewController.xib中添加一個(gè)按鈕,并控制單擊ViewController.h的按鈕以創(chuàng)建內(nèi)部補(bǔ)全事件。轉(zhuǎn)到ViewController.m中新創(chuàng)建的IBAction并將其更改為...- (IBAction)GoToNext:(id)sender {    ViewController2 *vc2 = [[ViewController2 alloc] initWithNibName:@"ViewController2" bundle:nil];    [[self navigationController] pushViewController:vc2 animated:YES];}代碼運(yùn)行無誤,我使用NSLog測(cè)試了按鈕的功能。但是,它仍然不能將我導(dǎo)航到第二個(gè)視圖控制器。任何幫助,將不勝感激。
查看完整描述

3 回答

?
隔江千里

TA貢獻(xiàn)1906條經(jīng)驗(yàn) 獲得超10個(gè)贊

let storyboard = UIStoryboard(name: "Main", bundle: nil)

let vc = storyboard.instantiateViewControllerWithIdentifier("NewsDetailsVCID") as NewsDetailsViewController?

?vc.newsObj = newsObj

?navigationController?.pushViewController(vc,

?animated: true)

或更安全


? if let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "NewsDetailsVCID") as? NewsDetailsViewController {

? ? ? ? viewController.newsObj = newsObj

? ? ? ? if let navigator = navigationController {

? ? ? ? ? ? navigator.pushViewController(viewController, animated: true)

? ? ? ? }

? ? }

當(dāng)下


? ?let storyboard = UIStoryboard(name: "Main", bundle: nil)

? ?let vc = self.storyboard?.instantiateViewControllerWithIdentifier("NewsDetailsVCID") as! NewsDetailsViewController

? ? ? vc.newsObj = newsObj

? ? ? ? ? ?present(vc!, animated: true, completion: nil)??

或更安全


? ?if let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "NewsDetailsVCID") as? NewsDetailsViewController

? ? ?{


? ? ?vc.newsObj = newsObj

? ? present(vc, animated: true, completion: nil)

? ? }






//Appdelegate.m


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

{

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

? ? // Override point for customization after application launch.

? ? self.viewController = [[ViewController alloc] initWithNibName:@"ViewController"

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bundle:nil];

? ? UINavigationController *navigation = [[UINavigationController alloc]initWithRootViewController:self.viewController];

? ? self.window.rootViewController = navigation;

? ? [self.window makeKeyAndVisible];

? ? return YES;

}



//ViewController.m


- (IBAction)GoToNext:(id)sender?

{

? ? ViewController2 *vc2 = [[ViewController2 alloc] init];? ? ?

? ? [self.navigationController pushViewController:vc2 animated:YES];

}

迅速


//Appdelegate.swift


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {

? ? self.window = UIWindow(frame: UIScreen.mainScreen().bounds)


? ? let navigat = UINavigationController()

? ? let vcw = ViewController(nibName: "ViewController", bundle: nil)


? ? // Push the vcw? to the navigat

? ? navigat.pushViewController(vcw, animated: false)


? ? // Set the window’s root view controller

? ? self.window!.rootViewController = navigat


? ? // Present the window

? ? self.window!.makeKeyAndVisible()

? ? return true

}


//ViewController.swift


@IBAction func GoToNext(sender : AnyObject)

{

? ? let ViewController2 = ViewController2(nibName: "ViewController2", bundle: nil)

? ? self.navigationController.pushViewController(ViewController2, animated: true)

}



查看完整回答
反對(duì) 回復(fù) 2019-12-16
?
慕田峪7331174

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超13個(gè)贊

  UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"storyBoardName" bundle:nil];

    MemberDetailsViewController* controller = [storyboard instantiateViewControllerWithIdentifier:@"viewControllerIdentiferInStoryBoard"];

[self.navigationController pushViewController:viewControllerName animated:YES];

斯威夫特4:


let storyBoard = UIStoryboard(name: "storyBoardName", bundle:nil)

let memberDetailsViewController = storyBoard.instantiateViewController(withIdentifier: "viewControllerIdentiferInStoryBoard") as! MemberDetailsViewController

self.navigationController?.pushViewController(memberDetailsViewController, animated:true)



查看完整回答
反對(duì) 回復(fù) 2019-12-16
?
明月笑刀無情

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超4個(gè)贊

對(duì)于Swift,請(qǐng)使用以下代碼:


 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {

    self.window = UIWindow(frame: UIScreen.mainScreen().bounds)

    self.window!.backgroundColor = UIColor.whiteColor()


    // Create a nav/vc pair using the custom ViewController class


    let nav = UINavigationController()

    let vc = NextViewController(nibName: "NextViewController", bundle: nil)


    // Push the vc onto the nav

    nav.pushViewController(vc, animated: false)


    // Set the window’s root view controller

    self.window!.rootViewController = nav


    // Present the window

    self.window!.makeKeyAndVisible()

    return true


}

ViewController:


 @IBAction func Next(sender : AnyObject)

{

    let nextViewController = DurationDel(nibName: "DurationDel", bundle: nil)


    self.navigationController.pushViewController(nextViewController, animated: true)

}



查看完整回答
反對(duì) 回復(fù) 2019-12-16
  • 3 回答
  • 0 關(guān)注
  • 671 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)