我遇到问题无法在UITextView
中设置新文字。我已在界面构建器中将IBOutlet
链接到textView
。这是我的代码
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"Detail";
[self setupTextView];
}
- (void) setupTextView
{
self.textDescription = [[[UITextView alloc] init] autorelease];
NSString *foo = @"blah blah blah";
textDescription.text = foo; //I try this and it didn't work
//here didn't work too.
//textDescription.text = [textDescription.text stringByAppendingString:foo];
/*Here is something for dynamic textview*/
CGRect frame;
frame = textDescription.frame;
frame.size.height = [textDescription contentSize].height;
textDescription.frame = frame;
/**/
}
感谢您的帮助:)
答案 0 :(得分:1)
self.textDescription = [[[UITextView alloc] init] autorelease];
我认为这是问题所在。如果textDescription
是IBOutlet
,则无需分配。{{1}}只需删除此分配。