我在來自webservice的UITableView
的七個部分中有七個圖像陣列。陣列圖像的數量可能是1或2或3,但最大數量是6.在每個部分中,我有2行每行有3個陣列圖像。 我將三個圖像視爲LeftImageview,middleImageview和rightImgaeview。沒有得到圖像的索引值
我將圖像發送到Looksfullimage viewcontroller.But雖然使用didSelectRowAtIndexPath:
委託方法我得到部分選擇,但沒有得到image.can的索引值任何人都建議如何獲得圖像的指數值相對於部分。
我也試圖獲得圖像的標籤值和應用按鈕上的三個圖像leftImagepressed action.I試圖通過保持int類型int的圖像標籤的某些沒有在cellforRowAtIndexPath:
委託方法,但我沒有得到部分正確找到tableview部分。我有imageview在看起來全圖像視圖控制器命名照片圖像視圖。我需要的是,當我點擊任何圖像在我看來,特定圖像應顯示在看起來全圖像視圖控制器的照片圖像視圖的一部分。我放置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];
}