0
我是新手在iOS开发我使用JSON数据数组显示tableview单元格数据我做不同的单元格为不同部分它正在工作,但现在我想在我的第一部分单元格只有数据数组第一个值和第二部分所有剩余的值是显示它如何可能?如何显示字典数组UITableview第一节中的第一个值和UITableview第二节中的剩余值?
我写我的第一单元中的代码,但它不工作
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0)
{
static NSString *[email protected]"CellOne";
CustumCell *cellOne =[tableView dequeueReusableCellWithIdentifier:CellIdentifierOne];
if (cellOne == nil)
{
NSArray *nibOne=[[NSBundle mainBundle]loadNibNamed:@"CustumCell" owner:self options:nil];
cellOne=[nibOne objectAtIndex:0];
cellOne.userInteractionEnabled=NO;
}
{
[cellOne.spinner startAnimating];
NSDictionary *dict = [self.imageArray objectAtIndex:indexPath.section];
NSString *img2=[dict valueForKey:@"front_image"];
[cellOne.storeImage sd_setImageWithURL:[NSURL URLWithString:[img2 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] placeholderImage:[UIImage imageNamed:@"Setting.png"] options:SDWebImageHighPriority completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL)
{
[cellOne.spinner stopAnimating];
cellOne.spinner.hidesWhenStopped=YES;
}];
}
return cellOne;
}
}
它显示在线路故障
NSDictionary *dict = [self.imageArray objectAtIndex:indexPath.section];
这里imagearray是JSON解析array.i知道这是问很多次,但我没有得到解决方案,请给我解决方案,如果有可能的话。
尝试indexPath.row代替ndexPath.section – 2014-11-04 07:59:28
错误显示什么? – 2014-11-04 08:11:32
没有任何错误,但应用程序不运行@SaurabhPrajapati – 2014-11-04 08:15:20