aherlambang
aherlambang

Reputation: 14418

UIView vs core graphics

I have a UITableViewCell subclass which draws a rectangular vertical line of 5px width and height of 100. I am using a UIView for this. However I am a bit afraid o the performance of using UIView. Is it better to use core graphics for stuff like this instead? If yes then how would you convert the following:

UIView *vLine = [UIView alloc] initWithFrame:CGRectMake(10, 0, 5, 100)]; [self addsubView:vLine] [vLine release]

How do you convert the above using CG?

Upvotes: 1

Views: 120

Answers (1)

Andy Obusek
Andy Obusek

Reputation: 12832

That is fine and won't cause a performance issue as long as it is not called with each invocation of cellForRowAtIndexPath Instead, create and add the subview only when an attempt to grab a reusable cell fails.

Upvotes: 2

Related Questions