我已阅读洛伦的文章 为 UITableViewCell 绘制自己的内容.但是,他使用了不推荐使用的方法:initWithFrame:reuseIdentifier: 在 UITableViewCell 上已被弃用.
I have read Loren's article on drawing your own content for UITableViewCell. However, he is using a deprecated method: initWithFrame:reuseIdentifier: is deprecated on UITableViewCell.
如何在不使用 initWithFrame:reuseIdentifier 的情况下让他的示例工作?
How do you get his example to work without using initWithFrame:reuseIdentifier?
推荐答案只需将 initWithFrame:reuseIdentifier: 替换为以下内容.
just had to replace initWithFrame:reuseIdentifier: with the following.
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { // you might want to add the UIView to [self contentView] // so that in edit's the cell's content will be automatically adjusted. ABTableViewCellView *myUIView = [[ABTableViewCellView alloc] initWithFrame:CGRectZero]; myUIView.opaque = YES; contentViewForCell = myUIView; [self addSubview:myUIView]; [myUIView release]; } return self; }此外,苹果有一个 Loren 指出的例子,但他们使用 initWithStyle:reuseIdentifier:
Also, apple has an example as Loren points out but they use initWithStyle:reuseIdentifier:
developer.apple/iphone/library/samplecode/TableViewSuite/Introduction/Intro.html
更多推荐
不使用不推荐使用的方法 initWithFrame:reuseIdentifier 的 UITableViewCell
发布评论