我使用的Web服務的iPhone應用程序開發太緩慢。我使用NSDictionary來使用JSONParsing獲取數據。這是一個從Web服務來快速,但它太緩慢,同時結合我的看法/ XIB.I我不是得到什麼是this.Because這是他們的任何其他解決方案或工作例如快於Android,但不是iPhone.Is實際問題解決這個問題。數據綁定,查看是在使用Web服務
碼 -
- (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;
}
你的問題是不是遠程連接到Xcode中的圖像數據。它恰好是你正在使用的ide。 –
請顯示一些代碼,特別是將數據綁定到視圖的位置。並提供一些細節,說明你如何發現請求很慢,但數據綁定不是。 –
確保您正在主線程上更新您的用戶界面。有可能您的下載發生在後臺線程上,然後您將更新您的視圖(您不應該這樣做)。由此可見,您的用戶界面會慢慢更新。正如@HermannKlecker所說,發佈一些代碼。 – sbarow