Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fast Scrolling in Tweetie with UITableView

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?

like image 796
CodingWithoutComments Avatar asked Jun 15 '09 03:06

CodingWithoutComments


2 Answers

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 ...

}
like image 178
CodingWithoutComments Avatar answered Nov 05 '22 08:11

CodingWithoutComments


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.

like image 2
kolywater Avatar answered Nov 05 '22 07:11

kolywater