I am trying to create a quick scroll list using the Tweetie creator, Loren Brichter technique (or this method ). I believe the idea is to "make your own drawing" instead of using subzones and images in a UITableViewCell.
Below I distributed his example to include an image, and I'm not sure if this is the right way to do this?
I am trying to play with CALayer and struggling to “get.” So, here, in this example, I just drew an image. But I'm not sure - does this look like the way an image is displayed in a view? Then I will use UIGraphicsBeginImageContext to include more images (e.g. footerImage)
Is what I'm doing in this example to improve performance by creating all this in IB?
thanks
- (void)drawContentView:(CGRect)r
{
CGContextRef context = UIGraphicsGetCurrentContext();
UIColor *backgroundColor = [UIColor whiteColor];
UIColor *textColor = [UIColor blackColor];
if(self.selected)
{
backgroundColor = [UIColor clearColor];
textColor = [UIColor whiteColor];
}
[backgroundColor set];
CGContextFillRect(context, r);
CGRect profile = CGRectMake(0, 0, 320, 20);
[headerImage drawInRect:profile];
CGPoint p;
p.x = 12;
p.y = 9;
[textColor set];
CGSize s = [firstText drawAtPoint:p withFont:firstTextFont];
p.x += s.width + 6;
[lastText drawAtPoint:p withFont:lastTextFont];
}
source
share