2012-10-26 3 views
-2

enter image description here 웹 서비스에서 오는 UITableView의 7 개 섹션에 7 개의 이미지 배열이 있습니다. 배열 이미지 수는 1 또는 2 또는 3 일 수 있지만 최대 개수는 6 개입니다. 각 섹션에 2 개의 행이 있습니다 각 행에 3 개의 배열 이미지가 있습니다. 세 이미지 뷰를 LeftImageview, middleImageview 및 rightImgaeview로 명명했습니다. 내가 선택한 섹션을 받고 있지만 부분에 대한 이미지 모두 인덱스 값을 얻는 방법을 제안 image.can 사람의 인덱스 값을 받고 있지 않다 didSelectRowAtIndexPath: 위임 방법을 사용하는 동안이미지의 색인 값을 가져 오지 못함

은 내가 Looksfullimage viewcontroller.But에 이미지를 전송하고 있습니다.

또한 leftImagepressed action.I 이미지 3 개의 이미지에 태그 값을 얻으려고 시도했습니다 위임 메서드에서 int 형식의 imagetagvalue 유지하여 tableview 섹션을 찾으려고했지만 올바르게 섹션을 가져 오는 오전 . 전체 이미지보기 컨트롤러에서 보이는 사진 이미지 view.My 필요에 내 imageview.My 필요가있다 내 이미지의 특정 섹션에서 이미지를 클릭하면 전체 이미지보기 컨트롤러의 사진 이미지 view.I에서 screeshot을 배치해야합니다 특정 이미지가 표시되어야합니다 내 tableview. 누구든지 제안 할 수 있습니다 .....

미리 감사드립니다.

- (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]; 
} 

답변

0

뷰를 스크롤하도록 테이블 뷰를 변경했습니다. 이미지의 각 버튼에 태그를 적용했습니다. 이제는 정상적으로 작동합니다 ......

0

이미지의 인덱스 경로를 얻을 수는 didSelectRowAtIndexPath 당신을 줄 것이다 어떤 3 개 이미지를 포함하는 선택된 행의 인덱스 경로입니다.

당신이해야 할 일은 imageView 클래스를 확장하고 이미지를 터치하여 어떤 이미지가 클릭되었는지 확인하는 것입니다.

관련 문제