5
我正在尝试重新创建Xcode项目,但遇到错误“'initWithFrame:reuseIdentifier'已弃用”。 下面是代码:'initWithFrame:reuseIdentifier'已弃用
- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
UIView *myContentView = self.contentView;
self.todoPriorityImageView = [[UIImageView alloc] initWithImage:priority1Image];
[myContentView addSubview:self.todoPriorityImageView];
[self.todoPriorityImageView release];
self.todoTextLabel = [self newLabelWithPrimaryColor:[UIColor blackColor]
selectedColor:[UIColor whiteColor] fontSize:14.0 bold:YES];
self.todoTextLabel.textAlignment = UITextAlignmentLeft; // default
[myContentView addSubview:self.todoTextLabel];
[self.todoTextLabel release];
self.todoPriorityLabel = [self newLabelWithPrimaryColor:[UIColor blackColor]
selectedColor:[UIColor whiteColor] fontSize:10.0 bold:YES];
self.todoPriorityLabel.textAlignment = UITextAlignmentRight;
[myContentView addSubview:self.todoPriorityLabel];
[self.todoPriorityLabel release];
// Position the todoPriorityImageView above all of the other views so
// it's not obscured. It's a transparent image, so any views
// that overlap it will still be visible.
[myContentView bringSubviewToFront:self.todoPriorityImageView];
}return self;}
我正在上2号线的误差与if语句的开始。 这个功能显然不是adviceable再使用,现在是这样的功能:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code.
}
return self;}
我真的不知道我怎么能修改上面的功能,并把它的新功能!请问有人可以帮我解决这个问题吗?
THX
凯文
的可能重复[UITableViewCell中不使用过时的方法initWithFrame:方法reuseIdentifier(http://stackoverflow.com/questions/2815121/的UITableViewCell-而不-使用弃用法-initwithframereuseidentifier) –