views:

1249

answers:

4

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?

A: 

Sorry, but we can't quite yet answer 3.0 specific answers yet do to the NDA... hopefully soon after 3.0 is released the restriction will be lifted.

In the meantime read the docs on 3.0 UITableViewCells and how selection works now, the answer may come to you.

Kendall Helmstetter Gelner
yeah. i just realized that when I posted the question, but decided to post anyway.
CodingWithoutComments
A: 

Maybe this behavior will be magically fixed by the time the NDA no longer applies. In the mean time file bugs as inquiries to the people who want you to use 3.0 but not talk about it.

dlamblin
+3  A: 

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

}
CodingWithoutComments
A: 

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.

kolywater