Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在TableViewFirst部分加载JSON数组的第一个对象,在第二部分加载剩余的对象?_Ios_Objective C_Json_Uitableview - Fatal编程技术网

Ios 如何在TableViewFirst部分加载JSON数组的第一个对象,在第二部分加载剩余的对象?

Ios 如何在TableViewFirst部分加载JSON数组的第一个对象,在第二部分加载剩余的对象?,ios,objective-c,json,uitableview,Ios,Objective C,Json,Uitableview,我是iOS开发的新手。我制作了一个包含JSON数据的应用程序,我想在TableView第一节中显示JSON数组第一个对象,所有剩余的数据对象都显示在TableView第二节中,我的TableView每个节都包含不同的TableViewCell代码,然后它会根据我的需要加载不同的单元格,但数据不会加载到每个单元格中 在这里,我为第一部分编写的代码是 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPat

我是iOS开发的新手。我制作了一个包含JSON数据的应用程序,我想在TableView第一节中显示JSON数组第一个对象,所有剩余的数据对象都显示在TableView第二节中,我的TableView每个节都包含不同的TableViewCell代码,然后它会根据我的需要加载不同的单元格,但数据不会加载到每个单元格中

在这里,我为第一部分编写的代码是

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0)
{
    static NSString *CellIdentifierOne=@"CellOne";
    CustumCell *cellOne =[tableView dequeueReusableCellWithIdentifier:CellIdentifierOne];
    if (cellOne == nil)
    {
        NSArray *nibOne=[[NSBundle mainBundle]loadNibNamed:@"CustumCell" owner:self options:nil];
        cellOne=[nibOne objectAtIndex:0];
    }
    {
        [cellOne.spinner startAnimating];
        NSDictionary *dict = [self.imageArray objectAtIndex:1];
        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;

         }];
        NSString *title=[dict valueForKey:@"title"];
        cellOne.titleLabel.text=title;

        NSString *shrtDescrpt=[dict valueForKey:@"short_description"];
        cellOne.shortDescriptionLabel.text=shrtDescrpt;
    }
    return cellOne;
}
}
当我运行应用程序时,它在行中包含错误

NSDictionary *dict = [self.imageArray objectAtIndex:1];
请给我解决方案和我为第二部分编写的代码,以加载数组剩余对象

并且Tableview行和节代码为

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView   
{ 
return 2;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0)
{
    return 1;
}
else
{
    return self.imageArray.count - 1;
}
}

打印日志self.imageArrayNot运行它在NSDictionary*dict=[self.imageArray objectAtIndex:1]中包含错误;这一行。Ashish删除数组中的1值并打印它,但bro我想在我的第一节中对象1的数据值表示第一节arry值,第二节我想重新打印值请给我解决方案。确定打印self.imageArray的日志数据后