0

I am trying make an NSString retain its value in another view controller, and it works when I push to the viewcontroller controller. However when I use the apple's navigation back button (automatically generated) it doesn't retain the value. How do I overcome this? I believe the automatic back button is poptoviewcontroller. I will post some code to help give you an idea.

NSString *ee = @"energy";
optViewController.energy = ee;

Controller I am trying to goto.

 @property (strong,nonatomic) NSString *energy
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Joe Jack
  • 1
  • 1

1 Answers1

0

I followed this answer and it worked great: https://stackoverflow.com/a/9736559/2670912. I found that using a protocol worked the best for me. And it helped me avoid rigidity.

Community
  • 1
  • 1