Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mikezang

macrumors 6502a
Original poster
May 22, 2010
854
7
Tokyo, Japan
I am using a table view and download data using performSelectorInBackground, but I found I can scroll table view when I download, what can I do?
Thanks for your suggestion.
 

mikezang

macrumors 6502a
Original poster
May 22, 2010
854
7
Tokyo, Japan
I have a table view controller as below:
Code:
@interface MasterTableViewController : UITableViewController {
    MonthData *monthData;
	
    DetailViewController *detailViewController;
}

The MonthData class as below
Code:
@interface MonthData : NSObject <NewerFileDownloadDelegate> {
    NSArray *allData;
    NewerFileDownload *download;
}

- (void)downloadData {
    [download start];
}
The class NewerFileDownload is a wrapper class for ASINetworkQueue/ASIHttpRequest. it looks like as below:
Code:
@interface NewerFileDownload : NSObject {
    ASINetworkQueue *networkQueue;
    ASIHTTPRequest *request;
	
    id delegate;
}

- (void)start {
    request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:fileName]];
	
    [networkQueue addOperation:request];
    [networkQueue go];
}

When I click download button, I call code as below:
Code:
- (IBAction)download:(id)sender {
    [self performSelectorInBackground:@selector(downloadEvents) withObject:nil];
}

- (void)downloadEvents {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    [monthData downloadData];
    [pool release];
}
 

Luke Redpath

macrumors 6502a
Nov 9, 2007
733
6
Colchester, UK
ASIHTTP is already using an operation queue to perform the network request asynchronously; there is no need for you to call this selector on a background thread.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.