开发者

Can't change text in textview

开发者 https://www.devze.com 2023-02-28 06:53 出处:网络
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

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


self.textDescription = [[[UITextView alloc] init] autorelease];

I think this is the problem. If textDescription is an IBOutlet you don't need to allocate it. Just remove this allocation.

0

精彩评论

暂无评论...
验证码 换一张
取 消