Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/42.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
Iphone 未获取图像的索引值_Iphone_Tableview - Fatal编程技术网

Iphone 未获取图像的索引值

Iphone 未获取图像的索引值,iphone,tableview,Iphone,Tableview,我在来自webservice的UITableView的七个部分中有七个图像数组。数组图像计数可能是1、2或3,但最大计数是6。在每个部分中,我有两行,每行有三个数组图像。 我将三个ImageView命名为LeftImageview、middleImageview和rightImgaeview 我正在将图像发送到Looksfullimage viewcontroller。但在使用didSelectRowAtIndexPath:delegate方法时,我选择了节,但没有获取图像的索引值。有人能建议如

我在来自webservice的
UITableView
的七个部分中有七个图像数组。数组图像计数可能是1、2或3,但最大计数是6。在每个部分中,我有两行,每行有三个数组图像。 我将三个ImageView命名为LeftImageview、middleImageview和rightImgaeview

我正在将图像发送到Looksfullimage viewcontroller。但在使用
didSelectRowAtIndexPath:
delegate方法时,我选择了节,但没有获取图像的索引值。有人能建议如何获取与节相关的图像的索引值吗

我还尝试获取图像的标记值,并使用leftImagepressed操作在三个图像上应用按钮。我尝试通过将int类型的imagetagvalue在
CellForRowatineXpath:
委托方法中保持为no来查找tableview的部分,但我没有正确获取部分。我在名为照片图像视图。我需要的是,当我单击视图某个部分中的任何图像时,该特定图像应显示在完整图像视图控制器的照片图像视图中。我正在放置我的tableview的screeshot。 谁能建议

提前谢谢

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *MyIdentifier= @"MyIdentifier";

    LooksCustomCell* cell= (LooksCustomCell *)[myTableView dequeueReusableCellWithIdentifier:MyIdentifier];
    if(cell==nil)
    {
        [[NSBundle mainBundle] loadNibNamed:@"LooksCustomCell" owner:self options:nil];
        cell=self.looksCustomCell;
    }
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
    if(indexPath.section==0)
    {
        self.imageTagValue=1;

        NSLog(@"the tag value at section 0 is:%d",self.imageTagValue);
        if ([self.looksTodayDataArray count]>0)
        {
            if ([self.looksTodayDataArray count]>indexPath.row*3)
            {
                LooksObject *looksObjectRef1 = [self.looksTodayDataArray objectAtIndex:indexPath.row*3];

                [cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];
                cell.leftImageButton.tag=indexPath.row*3;


            }
                       //[cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage]];
            //  [cell.leftImageView setContentMode:UIViewContentModeScaleAspectFit];

            if ([self.looksTodayDataArray count]>(indexPath.row*3)+1)
            {
                LooksObject *looksObjectRef2 = [self.looksTodayDataArray objectAtIndex:(indexPath.row*3)+1];

                [cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];
                cell.middleImageButton.tag=(indexPath.row*3)+1;

            }
            // [cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage]];
            //  [cell.middleImageView setContentMode:UIViewContentModeScaleAspectFit];
            if ([self.looksTodayDataArray count]>(indexPath.row*3)+2)
            {
                LooksObject *looksObjectRef3 = [self.looksTodayDataArray objectAtIndex:(indexPath.row*3)+2];

                [cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];
                cell.rightImageButton.tag=(indexPath.row*3)+2;

            }
            //[cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage]];
            //   [cell.rightImageView setContentMode:UIViewContentModeScaleAspectFit];



        }
    }
    if(indexPath.section==1)
    {
        self.imageTagValue=2;
        if ([self.looksYesterdayDataArray count]>0)
        {
            if ([self.looksYesterdayDataArray count]>indexPath.row*3)
            {
                LooksObject *looksObjectRef1 = [self.looksYesterdayDataArray objectAtIndex:indexPath.row*3];
                [cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];
                cell.leftImageButton.tag=indexPath.row*3;

            }
            //[cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage]];
            // [cell.leftImageView setContentMode:UIViewContentModeScaleAspectFit];

            if ([self.looksYesterdayDataArray count]>(indexPath.row*3)+1)
            {
                LooksObject *looksObjectRef2 = [self.looksYesterdayDataArray objectAtIndex:(indexPath.row*3)+1];

                [cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.middleImageButton.tag=(indexPath.row*3)+1;
            }
            //[cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage]];
            //  [cell.middleImageView setContentMode:UIViewContentModeScaleAspectFit];
            if ([self.looksYesterdayDataArray count]>(indexPath.row*3)+2)
            {
                LooksObject *looksObjectRef3 = [self.looksYesterdayDataArray objectAtIndex:(indexPath.row*3)+2];
                [cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.rightImageButton.tag=(indexPath.row*3)+2;

            }
            //[cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage]];
            //  [cell.rightImageView setContentMode:UIViewContentModeScaleAspectFit];


        }

    }
    if(indexPath.section==2)
    {
        self.imageTagValue=3;
        if ([self.day5DataArray count]>0)
        {
            if ([self.day5DataArray count]>indexPath.row*3)
            {
                LooksObject *looksObjectRef1 = [self.day5DataArray objectAtIndex:indexPath.row*3];
                [cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];
                cell.leftImageButton.tag=indexPath.row*3;

            }
            //[cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage]];
            //  [cell.leftImageView setContentMode:UIViewContentModeScaleAspectFit];

            if ([self.day5DataArray count]>(indexPath.row*3)+1)
            {
                LooksObject *looksObjectRef2 = [self.day5DataArray objectAtIndex:(indexPath.row*3)+1];

                [cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.middleImageButton.tag=(indexPath.row*3)+1;
            }
            //[cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage]];
            // [cell.middleImageView setContentMode:UIViewContentModeScaleAspectFit];
            if ([self.day5DataArray count]>(indexPath.row*3)+2)
            {
                LooksObject *looksObjectRef3 = [self.day5DataArray objectAtIndex:(indexPath.row*3)+2];

                [cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.rightImageButton.tag=(indexPath.row*3)+2;

            }


            //[cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage]];
            // [cell.rightImageView setContentMode:UIViewContentModeScaleAspectFit];



        }
    }
    if(indexPath.section==3)
    {
        self.imageTagValue=4;
        if ([self.day4DataArray count]>0)
        {
            if ([self.day4DataArray count]>indexPath.row*3)
            {
                LooksObject *looksObjectRef1 = [self.day4DataArray objectAtIndex:indexPath.row*3];

                [cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];
                cell.leftImageButton.tag=indexPath.row*3;

            }
            // [cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage]];
            // [cell.leftImageView setContentMode:UIViewContentModeScaleAspectFit];
            if ([self.day4DataArray count]>(indexPath.row*3)+1)
            {

                LooksObject *looksObjectRef2 = [self.day4DataArray objectAtIndex:(indexPath.row*3)+1];

                [cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.middleImageButton.tag=(indexPath.row*3)+1;
            }
            //[cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage]];
            // [cell.middleImageView setContentMode:UIViewContentModeScaleAspectFit];
            if ([self.day4DataArray count]>(indexPath.row*3)+2)
            {
                LooksObject *looksObjectRef3 = [self.day4DataArray objectAtIndex:(indexPath.row*3)+2];

                [cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.rightImageButton.tag=(indexPath.row*3)+2;

            }
            //[cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage]];
            // [cell.rightImageView setContentMode:UIViewContentModeScaleAspectFit];



        }
    }
    if(indexPath.section==4)
    {
       self.imageTagValue=5;
        if ([self.day3DataArray count]>0)
        {
            //[cell.image1 setImageWithURL:[NSURL URLWithString:tempBud.bigImageUrl] placeholderImage:[UIImage imageNamed:@"IBudDummyPic.png"]];
            if ([self.day3DataArray count]>indexPath.row*3)
            {

                LooksObject *looksObjectRef1 = [self.day3DataArray objectAtIndex:indexPath.row*3];


                [cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.leftImageButton.tag=indexPath.row*3;

                self.imageTagValue=5;

            }
            if ([self.day3DataArray count]>(indexPath.row*3)+1)
            {

                                LooksObject *looksObjectRef2 = [self.day3DataArray objectAtIndex:(indexPath.row*3)+1];
                [cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.middleImageButton.tag=(indexPath.row*3)+1;
            }
            //[cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage]];
            //  [cell.middleImageView setContentMode:UIViewContentModeScaleAspectFit];
            if ([self.day3DataArray count]>(indexPath.row*3)+2)
            {
                LooksObject *looksObjectRef3 = [self.day3DataArray objectAtIndex:(indexPath.row*3)+2];
                [cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.rightImageButton.tag=(indexPath.row*3)+2;

            }
            //[cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage]];
            // [cell.rightImageView setContentMode:UIViewContentModeScaleAspectFit];



        }
    }
    if(indexPath.section==5)
    {
        self.imageTagValue=6;
        if ([self.day2DataArray count]>0)
        {
            if ([self.day2DataArray count]>indexPath.row*3)
            {
                LooksObject *looksObjectRef1 = [self.day2DataArray objectAtIndex:indexPath.row*3];

                [cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.leftImageButton.tag=indexPath.row*3;

            }
            //[cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage]];
            //  [cell.leftImageView setContentMode:UIViewContentModeScaleAspectFit];

            if ([self.day2DataArray count]>(indexPath.row*3)+1)
            {
                LooksObject *looksObjectRef2 = [self.day2DataArray objectAtIndex:(indexPath.row*3)+1];

                [cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.middleImageButton.tag=(indexPath.row*3)+1;
            }
            //[cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage]];
            //   [cell.middleImageView setContentMode:UIViewContentModeScaleAspectFit];
            if ([self.day2DataArray count]>(indexPath.row*3)+2)
            {
                LooksObject *looksObjectRef3 = [self.day2DataArray objectAtIndex:(indexPath.row*3)+2];

                [cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.rightImageButton.tag=(indexPath.row*3)+2;

            }
            //[cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage]];
            //   [cell.rightImageView setContentMode:UIViewContentModeScaleAspectFit];



        }
    }
    if(indexPath.section==6)
    {
        self.imageTagValue=7;
        if ([self.day1DataArray count]>0)
        {
            if ([self.day1DataArray count]>indexPath.row*3)
            {
                LooksObject *looksObjectRef1 = [self.day1DataArray objectAtIndex:indexPath.row*3];

                [cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];
                cell.leftImageButton.tag=indexPath.row*3;

            }
            //[cell.leftImageView setImageWithURL:[NSURL URLWithString:looksObjectRef1.looksThumbImage]];
            //   [cell.leftImageView setContentMode:UIViewContentModeScaleAspectFit];

            if ([self.day1DataArray count]>(indexPath.row*3)+1)
            {
                LooksObject *looksObjectRef2 = [self.day1DataArray objectAtIndex:(indexPath.row*3)+1];

                [cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.middleImageButton.tag=(indexPath.row*3)+1;
            }
            //[cell.middleImageView setImageWithURL:[NSURL URLWithString:looksObjectRef2.looksThumbImage]];
            // [cell.middleImageView setContentMode:UIViewContentModeScaleAspectFit];
            if ([self.day1DataArray count]>(indexPath.row*3)+2)
            {
                LooksObject *looksObjectRef3 = [self.day1DataArray objectAtIndex:(indexPath.row*3)+2];

                [cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage] placeholderImage:[UIImage imageNamed:@"FashTag_no_image.png"]];

                cell.rightImageButton.tag=(indexPath.row*3)+2;

            }
            //[cell.rightImageView setImageWithURL:[NSURL URLWithString:looksObjectRef3.looksThumbImage]];
            //  [cell.rightImageView setContentMode:UIViewContentModeScaleAspectFit];



        }
    }
    return cell;    
}
-(void)tableView:(UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath
{

    LooksFullImageViewController *looksFullImageVC=[[LooksFullImageViewController alloc]initWithNibName:@"LooksFullImageViewController" bundle:nil];

    if(indexPath.section==0)
    {
        looksFullImageVC.array=self.looksTodayDataArray;
    }
    else if(indexPath.section==1)
    {
        looksFullImageVC.array=self.looksYesterdayDataArray;
    }
    else if(indexPath.section==2)
    {    

        looksFullImageVC.array=self.day5DataArray;
            }
    else if(indexPath.section==3)
    {
        looksFullImageVC.array=self.day4DataArray;
            }
    else if(indexPath.section==4)
    {
        looksFullImageVC.array=self.day3DataArray;

    }
    else if(indexPath.section==5)
    {
        looksFullImageVC.array=self.day2DataArray;

    }
    else if(indexPath.section==6)    
    {
    looksFullImageVC.array=self.day1DataArray;

    }
     [self.navigationController pushViewController:looksFullImageVC animated:YES];


}
-(IBAction)leftImageButtonPressed:(id)sender
{
    LooksFullImageViewController *looksFullImageVC=[[LooksFullImageViewController alloc]initWithNibName:@"LooksFullImageViewController" bundle:nil];
    if(self.imageTagValue==1)
    {
    looksFullImageVC.array=self.looksTodayDataArray;
    looksFullImageVC.tagValue=[sender tag];

    }
    if(self.imageTagValue==2)
    {
        looksFullImageVC.array=self.looksYesterdayDataArray;
        looksFullImageVC.tagValue=[sender tag];
    }
    if(self.imageTagValue==3)
    {
        looksFullImageVC.array=self.day5DataArray;
        looksFullImageVC.tagValue=[sender tag];
    }
    if(self.imageTagValue==4)
    {
        looksFullImageVC.array=self.day4DataArray;
        looksFullImageVC.tagValue=[sender tag];
    }
    if(self.imageTagValue==5)
    {
        looksFullImageVC.array=self.day3DataArray;
        looksFullImageVC.tagValue=[sender tag];
    }
    if(self.imageTagValue==6)
    {
        looksFullImageVC.array=self.day2DataArray;
        looksFullImageVC.tagValue=[sender tag];
    }
    if(self.imageTagValue==7)
    {
        looksFullImageVC.array=self.day1DataArray;
        looksFullImageVC.tagValue=[sender tag];
    }
    //looksFullImageVC.tagValue=indexPath.row;
    //fullimage.scrollValue=2;
    [self.navigationController pushViewController:looksFullImageVC animated:YES];
}

无法获取图像的索引路径,didSelectRowAtIndexPath将为您提供所选行的索引路径,其中包含3个图像


您需要做的是扩展imageView类,并在图像上实现触摸,以确定单击了哪个图像。

我将表格视图更改为滚动视图。并将标记应用于图像的每个按钮。现在一切正常