Note that there are some explanatory texts on larger screens.

plurals
  1. PONot getting the index value of image
    primarykey
    data
    text
    <p><img src="https://i.stack.imgur.com/1apFG.png" alt="enter image description here">I have seven arrays of images in seven sections of <code>UITableView</code> coming from webservice.The array images count may be 1 or 2 or 3 but maximum count is 6.In each section i have 2 rows with 3 images of array at each row. I named three imageviews as LeftImageview,middleImageview and rightImgaeview. </p> <p>i am sending the image to Looksfullimage viewcontroller.But while using <code>didSelectRowAtIndexPath:</code> delegate method i am getting section selected but not getting the index value of image.can anyone suggest how to get both index value of image with respect to section.</p> <p>I also tried to get tag value of image and applying button on three images with leftImagepressed action.I tried to find section of tableview by keeping imagetagvalue of type int to some no at <code>cellforRowAtIndexPath:</code> delegate method but i am not getting section correctly.I have imageview at looks full image view controller named photo image view.My need is when i click any image in a section of my view that particular image should be showed at looks full image view controller's photo image view.I am placing screeshot of my tableview. can anyone suggest.....</p> <p>Thanks in advance.</p> <pre><code>- (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]&gt;0) { if ([self.looksTodayDataArray count]&gt;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]&gt;(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]&gt;(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]&gt;0) { if ([self.looksYesterdayDataArray count]&gt;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]&gt;(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]&gt;(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]&gt;0) { if ([self.day5DataArray count]&gt;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]&gt;(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]&gt;(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]&gt;0) { if ([self.day4DataArray count]&gt;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]&gt;(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]&gt;(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]&gt;0) { //[cell.image1 setImageWithURL:[NSURL URLWithString:tempBud.bigImageUrl] placeholderImage:[UIImage imageNamed:@"IBudDummyPic.png"]]; if ([self.day3DataArray count]&gt;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]&gt;(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]&gt;(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]&gt;0) { if ([self.day2DataArray count]&gt;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]&gt;(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]&gt;(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]&gt;0) { if ([self.day1DataArray count]&gt;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]&gt;(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]&gt;(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]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload