Look at this link:
http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html
I used Subclassing UITableViewCell section to model my app and it works.
(1) I created an cellView calss which extended UITableViewCell
>>@interface ChartCell : UITableViewCell
(2) Created a CellView ChartCellView which extended UIView
and added to this the hosting view in initWithFrame method
hostingView = [[CPLayerHostingView alloc] initWithFrame:CGRectZero];
hostingView.frame = self.bounds;
hostingView.autoresizesSubviews = YES;
hostingView.autoresizingMask =
UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleLeftMargin;
[self addSubview:hostingView];
(3) Added the chartCellview in initWithStyle of UITableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style
reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:reuseIdentifier]) {
CGRect chartFrame = CGRectMake(0.0, 0.0,
self.contentView.bounds.size.width,
self.contentView.bounds.size.height);
chartCellView = [[ChartCellView alloc] initWithFrame:chartFrame];
chartCellView.autoresizingMask = UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight;
[self.contentView addSubview:chartCellView];
}
return self;
}
Thanks,
vJ