Guest User

Untitled

a guest
Aug 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. Carrying the contents of a label from one view controller to another
  2. @interface ViewControllerOne : UIViewController {
  3. IBOutlet UILabel *myLabelOne;
  4. }
  5.  
  6. @property (nonatomic, retain) IBOutlet UILabel *myLabelOne;
  7.  
  8. @end
  9.  
  10.  
  11. @interface ViewControllerTwo : UIViewController {
  12. IBOutlet UILabel *myLabelTwo;
  13. }
  14.  
  15. // myLabelTwo doesnt need to be a property, it could just be an ivar. Up to you.
  16. @property (nonatomic, retain) IBOutlet UILabel *myLabelTwo;
  17.  
  18. @end
  19.  
  20. @implementation ViewControllerTwo
  21.  
  22. - (void)viewDidLoad {
  23. [super viewDidLoad];
  24. self.myLabelTwo.text = [(ViewControllerOne *)self.navigationController.presentingViewController myLabelOne].text;
  25. }
  26.  
  27.  
  28. @end
Add Comment
Please, Sign In to add comment