簡體   English   中英

登錄視圖之前的模態視圖屏幕

[英]Modal view screen before login view

我是一名新手ios開發人員,我對如何向登錄頁面添加視圖有疑問。 目前,我有一個登錄頁面,我想做的是在登錄頁面可見之前,另一個模態視圖應使用戶必須先將其關閉。 如何在xcode中添加此內容?

這是呈現視圖控制器的幾個選項。

- (IBAction)goToLoginView:(id)sender
{
     //if you are using xibs use this line
     UIViewController *controller = [[UIViewController alloc] initWithNibName:@"myXib" bundle:[NSBundle mainBundle]];
     //if you are using storyboards use this line
     UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"myViewControllersID"];

     //to present the controller modally use this
     [self presentViewController:controller animated:YES completion:nil];
     //or if you are pushing to this controller using a navigation controller use this
     [self.navigationController pushViewController:controller animated:YES];
}

然后使用以下命令關閉視圖控制器:

- (IBAction)closeMyController
{
    //if the view was presented modally close it with this
    [self dismissViewControllerAnimated:YES completion:nil];

    //and to pop back up the navigation stack
    [self.navigationController popToRootViewControllerAnimated:YES];
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM