1

I want to make speech bubbles but there is a problem adjusting size of the bubbles in UITextView.

is there a way to increase the size of the Textview automatically depending on the length of the

text by using UITextView?

1
  • did you find an answer for this? Commented Mar 30, 2012 at 2:34

2 Answers 2

1

Okay I found a better way of doing what I was suggesting. Rather then deal with the UIView and resizing depending on the text inside it. I just made the UITextView have a rounded edge which now looks like a panel. Perfect. Hope this helps someone!

If your interested in the code

- (void)drawRect:(CGRect)rect
{
    CGRect frame = self.frame;
    frame.size.height = self.contentSize.height;
    self.frame = frame;     // Drawing code
    self.clipsToBounds = YES;
    self.layer.cornerRadius = 10.0f;    
}
Sign up to request clarification or add additional context in comments.

Comments

1

I think I understand what your getting at. I had this problem the other day. This bit of code will adjust the UITextView contents. Create a new class and call this into it via a new class. If you want to adjust the View well I'm still working on that :-P

Hope this helps

    - (void)drawRect:(CGRect)rect
{
    CGRect frame = self.frame;
    frame.size.height = self.contentSize.height;
    self.frame = frame;     // Drawing code
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.