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) –