I am a newbie to both Iphone dev and obj c. I am trying to call a web service when the view is loaded and display a activity indicator during the time it takes to retrieve result from the web service.
My problem is that once the ViewDidLoad
is completed, my activityindicator
and labels are getting null. Hence after the web service call I am not able to manipulate any of the controls.
I am not able to understand why this is happening; obviously it is my lack of understanding of the basics. I done a bit of homework on this but I have not reached anywhere. It would very helpful if some could please explain why the controls get null once the viewdidload
is complete.
Update: thank you for the answers. On viewdidload
, I am doing the following, I am animating an activity indicator and assigning some values to my textview
. Then I call a web service. Debugging the code, I realized that once viewdidload
is complete and -(void) connection: (NSURLConnection *) connection didReceiveResponse:(NSURLResponse *)
is called, my text view/activityindicator gets null.
(void)viewDidLoad {
[activityindicator startAnimating];
if(myarray != NULL) {
myuitextview.text = @""; // displaying some values from array
@try{
// call web service
} @catch (NSException *ns) {
}
}
}