无法更改文本视图中的文本
我无法在 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;
/**/
}
谢谢你的帮助:)
I have problem with can't set new text in UITextView
.I already link up the IBOutlet
to textView
in interface builder. Here is my code
- (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;
/**/
}
Thank you for anu help :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这就是问题所在。如果
textDescription
是IBOutlet
,则无需分配它。只需删除此分配即可。I think this is the problem. If
textDescription
is anIBOutlet
you don't need to allocate it. Just remove this allocation.