5

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?

4 Answers 4

6

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

}
2

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.

0

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.

1
  • yeah. i just realized that when I posted the question, but decided to post anyway. Jun 15, 2009 at 4:42
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.