View is deleted before loading

I am trying to delete a view after getting data from webservice.

But when I delete the view using

[self.view removeFromSuperView];

the view is deleted before loading the necessary data. I need to load data and then delete the view. Is there any way to implement this?

+5
source share
2 answers

if you are using NSURLConnection then you should use delegate methods that

-(void)connectionDidFinishLoading:(NSURLConnection *)connection

Here you can easily remove part of the view. and he will not fail unless he receives an answer.

+1
source

viewDidAppear - bool.

+1

All Articles