Posted By

magickaito on 03/28/11


Tagged

objectivec


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tintenklecks


Link to a new view controller from the first view controller


 / Published in: Objective C
 

  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  

You need to login to post a comment.