0

I have placed two button in navigation controller on click of each button it should open new view , how to load a new view on click of a button

3
  • Hehe nice Peter. There is not enough information here to awnser anything. Edit or delete I would recommend. Commented Dec 9, 2009 at 8:34
  • 1
    first comment is really cool) Commented Dec 9, 2009 at 11:53
  • Both comments are really cool Commented Mar 6, 2014 at 21:26

2 Answers 2

1

Right-click the Classes group in the project window of Xcode and select Add->New File… Select the UIViewController subclass template from the Cocoa Touch Classes and click Next. Name the view FirstViewController (make sure that the Also Created flag is selected) and click Finish. You get two files (FirstViewController.h and FirstViewController.m). Right-click again the Classes group and choose Add -> New File… This time, select View XIB template from the User Interface under iPhone. Click Next and name the file FirstViewController.xib. Click Finish. Repeat the last paragraph for the second and third view (name them SeconViewController and ThirdViewController).

Right-click the Classes group in the project window of Xcode and select Add->New File… Select the UIViewController subclass template from the Cocoa Touch Classes and click Next. Name the view FirstViewController (make sure that the Also Created flag is selected) and click Finish. You get two files (FirstViewController.h and FirstViewController.m). Right-click again the Classes group and choose Add -> New File… This time, select View XIB template from the User Interface under iPhone. Click Next and name the file FirstViewController.xib. Click Finish. Repeat the last paragraph for the second and third view (name them SeconViewController and ThirdViewController).

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

Comments

1

When you're operating with Navigation Controllers, transferring to a new screen and returning to the previous screen is achieved with pushing and popping new ViewControllers on a stack. So, assuming you have a UITableView inside your Navigation Controller you simply add this line to didSelectRowAtIndexPath:(NSIndexPath *)indexPath:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { MyNewController *controller = [MyNewController alloc] init]; [[self navigationController] pushViewController:controller animated:YES]; } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.