I have a subclass UITableViewCellthat makes its drawing in the drawRect: method. The entire rectangle is custom made, including the background. I was able to get very complex cells while keeping scrolling very smoothly.
My problem: I call [table deselectRowAtIndexPath:path animated:YES];whenever a view appears to match Apple HIG. However, the animation does not occur. This worked when I had a custom view (created using subviews) that was transparent (e.g. Apple background appeared below). Now this is not so.
My drawRect: called once during the "animation", about halfway. I think this is because it enlivens the selected property of the cell from 1 to 0, and it binds to 0 when it drops below 0.5.
How can I revive this transition? My guess would be to use the usual beginAnimations: etc. And animate a custom floating point field in my cell object from 1 to 0. Will this call drawRect:re-animate?
Update
I managed to work almost completely. I redefined setSelected: animated: like this:
- (void) setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:NO];
if (animated) {
[CATransaction begin];
CATransition* animation = [CATransition animation];
animation.type = kCATransitionFade;
animation.duration = 0.6;
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[view.layer addAnimation:animation forKey:@"deselectRow"];
[CATransaction commit];
}
}
, . (), , , , . ?