Objective c label text not updating
I set it to true if we navigate from view controller A in prepare For Segue method.
like below - So i am able to assign value from the service return to the label when we navigate from VC A to VC B. But I am not able to hide it when we navigate from VC C to VC B.
So, if you have a long, time consuming task going on on the main thread, run this code after setting the text of the label: - (void)do Something Time Consuming ... I highly suggest that you perform your app's time consuming tasks on a background thread, and update the UI through the main thread using Thanks for the suggestion. I am using AVFoundation to record some sound and using ASIHTTP class to upload the recorded sound. In the function that uploads the file (a custom function) , I am initially writing the code to change the label. I even tried perform Selector On Main Thread ...didnt work. I might even suggest making that solution appear more prominently in your answer so that people don't miss it, as it's currently the accepted answer?
Do you think the recording/uploading qualifies as a separate thread ? In my case the function that was updating was called from a touch recognizer on a thread, but the place in the function where I'm changing the value of the label's text property I put it back on the main thread: that I fired somewhere else.
However, the notification was fired from a background thread so even the listener methods that update the label's text are fired in the background.
my View Controller *tmp VC = [[my View Controller alloc] init With Nib Name:@"NIBfile" bundle:nil]; tmp VC.view; // Force view creation [tmp Label set Text:tmp Title]; // The debugger shows the text: my Title = "my Text" NSLog(@"%@", tmp Label); // NSLog will display "my Text" [self.navigation Controller push View Controller:tmp VC animated: YES]; Not sure but I think this is what's going on: When the view is pushed, the controller loads the view from the nib and hooks up the actions and outlets.
Let's see if we can see the data at that point.
My guess is that it will be null, and there's a problem with the key Val ivar or getter.
Before this, the outlets are not connected, so tmp Label is nil.
If you want to be sure, you could put a breakpoint in hmm, I think you're right there, but (a) when I try to add the ".text" I get a compiler error "member 'my Label' not in structure or union" (b) the preceeding set Text statement does not produce any updates in the view.
Then you can set the text using: If this doesn't work, go back to IB and open the Utilities pane.