3
我创建了UITableCellView
类为NoteCell
。头定义了下面的:无法在UILabel上设置文本字段
#import <UIKit/UIKit.h>
#import "Note.h"
@interface NoteCell : UITableViewCell {
Note *note;
UILabel *noteTextLabel;
}
@property (nonatomic, retain) UILabel *noteTextLabel;
- (Note *)note;
- (void)setNote:(Note *)newNote;
@end
在我对setNote:
方法如下代码的实现:
- (void)setNote:(Note *)newNote {
note = newNote;
NSLog(@"Text Value of Note = %@", newNote.noteText);
self.noteTextLabel.text = newNote.noteText;
NSLog(@"Text Value of Note Text Label = %@", self.noteTextLabel.text);
[self setNeedsDisplay];
}
这未能设置UILabel
的文本字段和日志消息的输出是:
2008-11-03 18:09:05.611 VisualNotes[5959:20b] Text Value of Note = Test Note 1
2008-11-03 18:09:05.619 VisualNotes[5959:20b] Text Value of Note Text Label = (null)
我也曾尝试使用下面的语法来设置的UILabel
文本字段:
[self.noteTextLabel setText:newNote.noteText];
这似乎没有什么区别。
任何帮助将不胜感激。
感谢您的快速响应,它立即解决了问题。我不能相信我没有发现这一点,我一直在盯着这个小时,并开始密码盲。 – lucasweb 2008-11-03 18:37:27