0

I am developing an e-com app for iPhone in which i need to open a view immediately when the user clicks on a button for the upcoming view, the data loads large images from server , to load images I am using a background thread .

Thank You

1
  • Depends on your navigation structure you can use: [self.navigationController pushViewController: YOURVIEWCONTROLLER](1) or [self presentModalViewController:YOURVIEWCONTROLLER animated:YES](2) or [self.view addSubview:YOURVIEW](3) - the first requires that your root controller is a UINavigationController, the second second be called in any viewController, the last one only adds the view without any controlling Commented Sep 7, 2012 at 7:18

3 Answers 3

5

Simple, here's how to create a UIViewController and present it from within an 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];
    }

Be sure to pass animated NO so that the view is displayed immediately.

Sign up to request clarification or add additional context in comments.

2 Comments

NSPostWhenIdle Thanks for reply ,i am dong same thing .. in my app loading big image from web server .. the network request code , i written inside viewWillAppear . but untill data is not received from server it show progress in same screen . i want open immediately next view window on click
@JackFarnandish If my post has helped you be sure to mark it as correct by clicking the "check mark" next to my post! Thanks!
0

You need to make a button and then add its action like

-(IBAction)ButtonAction:(id)sender{

CalController *calculateView=[[CalController alloc] initWithNibName:@"CalController" bundle:nil];
[self.navigationController presentModalViewController:calculateView animated:NO];  

}

Comments

0

You can use modal view controller for this

- (IBAction)showController:(id)sender {
    SampleViewController *sampleView = [[SampleViewController alloc] init];
    [self presentModalViewController:sampleView animated:YES];
}

Here it is the tutorial http://timneill.net/2010/09/modal-view-controller-example-part-1/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.