Search code examples
iosobjective-cuitextviewcgrectmake

How To Fix UITextView in storyboard TextView


Here i want to fix a UITextView which i created programatically in textView added on storyboard. I have tried it this way but not working.

_textView is a textView in which i have to fix UITextView *descrip

contentView is the view on which i have _textView.

  UITextView *descrip = [[UITextView alloc]init];

  descrip.view.frame = CGRectMake(_textView.frame.origin.x,_textView.frame.origin.y,_textView.frame.size.width,_textView.frame.size.height);

  [self.contentView addSubview:descrip.view];

Solution

  • here is proper method

    UITextView *descrip = [[UITextView alloc]initWithframe:CGRectMake(_textView.frame.origin.x,_textView.frame.origin.y,_textView.frame.size.width,_textView.frame.size.height)]
      [self.contentView addSubview:descrip];