Link to a new view controller from the first view controller


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #import "VCExampleViewController.h"
  2. //---import the header file for the view controller---
  3. #import "SecondViewController.h"
  4.  
  5. @implementation VCExampleViewController
  6. SecondViewController *secondViewController;
  7. //---add the view of the second view controller to the current view---
  8. -(IBAction) displayView:(id) sender{
  9. secondViewController = [[SecondViewController alloc]
  10. initWithNibName:@"SecondView"
  11. bundle:nil];
  12. [self.view addSubview:secondViewController.view];
  13. }
  14. - (void)dealloc {
  15. //---release the memory used by the view controller---
  16. [secondViewController release];
  17. [super dealloc];
  18. }
  19. @end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.