Reputation: 1439
I am trying to remove a View after getting data from webservice.
But when I removes the view using
[self.view removeFromSuperView];
the view gets removed before loading the required data. I need to load the data and then remove the view. Is there a way to implement this?
Upvotes: 5
Views: 78
Reputation: 1217
if you are using NSURLConnection then you should use the delegates methods which is
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
Here you can easily do the removing part of the view. and it will not crash unless got response.
Upvotes: 1
Reputation: 6402
Try removing view in viewDidAppear after checking the result of web service using some bool variable.
Upvotes: 1