itZme
itZme

Reputation: 1439

View removed before it loads

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

Answers (2)

IDev
IDev

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

PgmFreek
PgmFreek

Reputation: 6402

Try removing view in viewDidAppear after checking the result of web service using some bool variable.

Upvotes: 1

Related Questions