views:

7

answers:

1

Hi all,

I have 2 tabs in my application, when a tab is pressed an RSS feed is loaded and MBProgressHUB shows a loading spinner until the tab has finished loading and the view has appeared.

However if the other tab is pressed whilst the tab is still loading, 2 MBProgressHUB spinners appear and then the app crashes.

Is there anyway to ignore tab bar presses until the tab has finished loading?

My Code:

    -(void)refreshdata { 
 mbProcess=[[MBProgressHUD alloc] initWithView:self.view];
 mbProcess.labelText=@"Downloading data...";
 [theTable addSubview:mbProcess];
 [mbProcess setDelegate:self];
 [mbProcess show:YES];


 ......


    - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
 ......

 [mbProcess hide:YES];

Many Thanks!

A: 

Check if mbProcess is not nil and visible at beginning of refereshData, if so just return;

Jordan