Note that there are some explanatory texts on larger screens.

plurals
  1. POA UIlabel issue: Keep the string value after app is closed?
    primarykey
    data
    text
    <p>So one of the users in here managed to show me how to pass data from a child view controller to a parent view controller via a string.</p> <p>So now the string is passed, BUT, i want that value to stay displayed on the firstViewController after the app is closed and re-opened.</p> <p>The value is saved in with NSUserDefaults by the way and with an NSLog i am seeing on the conosole it is saved in the apps folder but that value isnt saved onto the UILabel display. </p> <p>It only displays it when i put save but then i close and reopen, it dissappears but in an NsLog it is still inside the app but not on display UILabel.</p> <p>How can i address this ?</p> <p>On my appDelegate.h i have a </p> <pre><code> @property (strong, nonatomic) NSString *sharedString; </code></pre> <p>To pass the secondViewController data to the firstViewController.</p> <p>In the save method on my secondViewController i have a function related to the AppDelegate.h declaration which is:</p> <pre><code>AppDelegate *apiDelegate = [[UIApplication sharedApplication] delegate] apiDelegate.sharedString = self.textFieldData.text; </code></pre> <p>And in my firstViewController i have a method which display the data from the second viewController:</p> <pre><code> -(void) viewDidAppear:(BOOL)animated { AppDelegate *apiDelegate = [[UIApplication sharedApplication] delegate] self.DisplayData.text = appDelegate.sharedString; [super viewDidAppear: NO]; </code></pre> <p>Is there something wrong which isnt keeping the data intact after app closes or am I missing something here ? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload