Custom Cell in UITableView programmatically?
I have a UITableView which gets loaded wi开发者_运维百科th data from a MutableArray. The thing is, within this array I have many different attributes, therefore I would like to enter these attributes into a custom cell programmatically.
Also I would like to include a Slider within the Cell so there will need to be some sort of addition there.
You say you've looked at tutorials, but have you checked out the "UITableView construction, drawing and management (revisited)" post on http://cocoawithlove.com - this pretty much covers the full custom UITableViewCell gamut, including loading a custom view from a NIB.
Irrespective, one potential approach is to create your own custom cell that expends the UITableViewCell and simply add a UISlider property which you'd then set up within the - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
method and add it as a sub view via [[self contentView] addSubview:yourUISlider];
, etc.
However, I'd be tempted to have a good look at the http://cocoawithlove.com article, and download the provided project as this will show you the available options in full.
精彩评论