My app is too slow in responding, I guess I’m not loading images Asynchronously, but even if I do still then the tableview makes my controller load too slow. The code for tableview is below:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease];
UILabel *productNameLbl = [[UILabel alloc] initWithFrame:CGRectMake(83, 8, 200,10)];
[productNameLbl setFont:[UIFont boldSystemFontOfSize:12.0]];
[productNameLbl setTag:20];
[cell.contentView addSubview:productNameLbl];
[productNameLbl release];
}
else {
AsyncImageView *oldImage = (AsyncImageView*)[cell.contentView viewWithTag:299];
[oldImage removeFromSuperview];
}
NSString *baseImageURL = @"http://samplesite.com/";
AsyncImageView* asyncImage = [[[AsyncImageView alloc] initWithFrame:CGRectMake(5, 5, 70, 70)] autorelease];
asyncImage.tag = 299;
NSMutableString *url = [[NSMutableString alloc] initWithString:@""];
NSString *iconUrl = [NSString stringWithString:[[[[[DataCollection sharedObject] categoryProducts ] productsList ]objectAtIndex:indexPath.row] productImage]];
[url appendString:baseImageURL];
[url appendString:iconUrl];
NSURL *imageURL = [NSURL URLWithString:url];
[asyncImage loadImageFromURL:imageURL];
[cell.contentView addSubview:asyncImage];
[(UILabel *) [cell viewWithTag:20] setText:[NSString stringWithString:[[[[[DataCollection sharedObject] categoryProducts ] productsList ]objectAtIndex:indexPath.row] productName]]];
//..... rest of the code
What I actually want is, to load the view first and then can load the images and rest of the data.
Please, tell me how can I make my tableview more responsive.
this was much easier and really solved the problem 🙂
http://ezekiel.vancouver.wsu.edu/~wayne/yellowjacket/YellowJacket.zip