tagは、アプリケーションのビューオブジェクトを識別するために使用できる整数なので、UIImageをタグとして使用することはできません.SinceタグはUIViewの継承されたプロパティであり、UIImage自体では使用できません。 UIImageViewで イメージビューにタグを設定する:
#define IMAGE_TAG_GREEN 50
#define IMAGE_TAG_RED 51
-(UITableViewCell*) tableView:(UITableView*) tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath {
static NSString *CELL_ID = @"some_cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CELL_ID];
if(cell == nil) {
//do setup here...
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CELL_ID] autorelease];
cell.imageView.tag = //some logic here...
}
if(cell.imageView.tag == IMAGE_TAG_GREEN) {
//...
} else {
//...
}
return cell;
}