Próbowałem odtworzyć projekt Xcode, ale napotkałem błąd "'initWithFrame: reuseIdentifier' jest przestarzałe". Oto kod:'initWithFrame: reuseIdentifier' jest przestarzałe
- (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;}
Otrzymuję błąd na line2 z początku IF-oświadczenie. Funkcja ta jest wyraźnie nie adviceable korzystać już teraz i to jest ta funkcja:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code.
}
return self;}
ja naprawdę nie wiem, jak można zmodyfikować powyższą funkcję i umieścić go w nowszych funkcji! Czy ktoś może mi pomóc w tej sprawie?
Thx
Kevin
możliwe duplikat [UITableViewCell bez stosując metodę przestarzałej initWithFrame: reuseIdentifier] (http://stackoverflow.com/questions/2815121/ uitableviewcell-without-using-deprecated-method-initwithframereuseidentifier) –