I am using web services for iPhone App development. I used NSDictionary for fetching data using JSONParsing. It's coming fast from web services but it's too much slow while binding to my view/XIB.I am not getting what is the actual issue with this.Because it's working fast on android but not on iPhone.Is their any other solution or example to solve this issue.
Code -
- (void)viewDidLoad
{
//returning cell with name & logo
NSLog(@"activity array = %@",activityArray);
addNameList = [[NSMutableArray alloc]init];
addThumbnails = [[NSMutableArray alloc]init];
addActivityId = [[NSMutableArray alloc]init];
for (int x=0; x<[activityArray count]; x++)
{
NSDictionary* toDist = [activityArray objectAtIndex:x];
[addNameList addObject:[toDist objectForKey:@"activity"]];
[addThumbnails addObject:[toDist objectForKey:@"icon"]];
[addActivityId addObject:[toDist objectForKey:@"id"]];
}
activityList = addNameList;
thumbnails = addThumbnails;
activityIdList = addActivityId;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
NSString *str = [NSString stringWithFormat:@"%@",[thumbnails objectAtIndex:indexPath.row]];
cell.imageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:str]]];
cell.textLabel.text = [activityList objectAtIndex:indexPath.row];
UIImageView *backImage = [[UIImageView alloc] initWithFrame:CGRectMake(20,20,277,58)];
backImage.backgroundColor = [UIColor clearColor];
backImage.opaque = NO;
backImage.image = [UIImage imageNamed:@"cellBackgroundImage.png"];
cell.backgroundView = backImage;
return cell;
}