如何在点击按钮时立即打开viewcontroller

Jac*_*ish 0 iphone

我正在为iPhone开发一个e-com应用程序,当用户点击即将到来的视图的按钮,数据从服务器加载大图像,加载我正在使用后台线程的图像时,我需要立即打开视图.

谢谢

Mic*_*lum 5

很简单,这里是如何创建一个UIViewController并从中呈现它IBAction.

- (IBAction)goToNextView:(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:NO completion:nil];
    //or if you are pushing to this controller using a navigation controller use this
        [self.navigationController pushViewController:controller animated:NO];
    }
Run Code Online (Sandbox Code Playgroud)

请务必传递动画,NO以便立即显示视图.