Reputation: 3400
I'm encountering a strange problem:
UIImageView* imageView = (UIImageView*)[self viewWithTag:1];
[imageView setImage: [UIImage imageNamed: @"open.png"]];
[imageView setHighlightedImage: [UIImage imageNamed: @"close.png"]];
imageView.highlighted = YES;
NSLog(@"%u", imageView.isHighlighted);// return YES
But the hilighted image never appears! What's the problem with ios 7? That drive me nuts. Can you explain me what i forgived?, that's so unintuitive
EDIT
This is not a compile problem. The question is still active. I just made a typo in my question. So will you forgive me that mistake?
I have put an image into a UITableViewCell
, and set a image / highlighted image from IB. But when I try a toggle:
imageView.isHighlighted = !imageView.isHighlighted;
nothing appears. But if i set the tableViewCell
to selected = YES
. The imageView show the highlighted image.
It seems like a bug, that's so frustrating.
* EDIT 2 **
Actually my code look like this:
- (void)displayExpandedCell:(NSUInteger)viewTag isHighlighted:(BOOL)isHilighted{
UIImageView* image1 = (UIImageView*)[self viewWithTag: viewTag];
if([image1 isKindOfClass: [UIImageView class]]){
image1.highlighted = isHilighted;
image1.alpha = isHilighted? .5f : 1;
}
}
The alpha actually works. But not the hilighted image.
Upvotes: 3
Views: 1087
Reputation: 2579
This will sound silly, but try renaming your imageView
to imageView1
or anything else, this will get solved. UITableViewCell
has a internal property named imageView
. Your naming may be conflicting with it.
Upvotes: 2