On December 12th 2008, the maker of the Tweetie IPhone App posted a great example how he accomplishes UITableView scrolling without the jagged/raggedness that normally entails. His example code works great with version 2.2 of the SDK, however, when I compile for 3.0 I cannot get the click-highlight to work on an individual cell. Anyone have any idea what needs to be updated from 2.2 -> 3.0 to get his code to (fully) work?
In drawContentView, change self.selected to self.highlighted
- (void)drawContentView:(CGRect)r
{
CGContextRef context = UIGraphicsGetCurrentContext();
UIColor *backgroundColor = [UIColor whiteColor];
UIColor *textColor = [UIColor blackColor];
if(self.highlighted)
{
backgroundColor = [UIColor clearColor];
textColor = [UIColor whiteColor];
}
... code continues ...
}
if you want the highlight to remain as the new view is being pushed and auto-dehighlighted on pop (default behavior for tableview cell's), make sure you also have the background transparent for self.selected:
if(self.highlighted || self.selected){
backgroundColor = [UIColor clearColor];
textColor = [UIColor whiteColor];
}
the cell will be automatically de-highlighted and de-selected when its child is popped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With