Skip to main content
edited body
Source Link
Bartłomiej Semańczyk
  • 61.9k
  • 52
  • 255
  • 406

I'm porting one of apps from iOS 6.1 to iOS 7. I'm using a layout where there's a UITextView that has a fix width, but it's height is based on its contentsize. For iOS 6.1 checking the contentsize.height and setting it as the textview's frame height was enough, but it doesn't work on iOS 7.

How can iI then create a UITextView with a fixed width, but dynamic height based on the text it's showing?

NOTE: I'm creating these views from code, not with Interface Builder.

I'm porting one of apps from iOS 6.1 to iOS 7. I'm using a layout where there's a UITextView that has a fix width, but it's height is based on its contentsize. For iOS 6.1 checking the contentsize.height and setting it as the textview's frame height was enough, but it doesn't work on iOS 7.

How can i then create a UITextView with a fixed width, but dynamic height based on the text it's showing?

NOTE: I'm creating these views from code, not with Interface Builder.

I'm porting one of apps from iOS 6.1 to iOS 7. I'm using a layout where there's a UITextView that has a fix width, but it's height is based on its contentsize. For iOS 6.1 checking the contentsize.height and setting it as the textview's frame height was enough, but it doesn't work on iOS 7.

How can I then create a UITextView with a fixed width, but dynamic height based on the text it's showing?

NOTE: I'm creating these views from code, not with Interface Builder.

deleted 30 characters in body
Source Link
Cole Tobin
  • 9.4k
  • 15
  • 52
  • 77

I'm porting one of apps from iOS 6.1 to iOS 7. I'm using a layout where there's a UITextView that has a fix width, but it's height is based on its contentsize. For iOS 6.1 checking the contentsize.height and setting it as the textview's frame height was enough, but it doesn't work on iOS 7.

How can i then create a UITextView with a fixed width, but dynamic height based on the text it's showing?

NOTE: I'm creating these views from code, not with Interface Builder.

Thanks in advance,

Zoli

I'm porting one of apps from iOS 6.1 to iOS 7. I'm using a layout where there's a UITextView that has a fix width, but it's height is based on its contentsize. For iOS 6.1 checking the contentsize.height and setting it as the textview's frame height was enough, but it doesn't work on iOS 7.

How can i then create a UITextView with a fixed width, but dynamic height based on the text it's showing?

NOTE: I'm creating these views from code, not with Interface Builder.

Thanks in advance,

Zoli

I'm porting one of apps from iOS 6.1 to iOS 7. I'm using a layout where there's a UITextView that has a fix width, but it's height is based on its contentsize. For iOS 6.1 checking the contentsize.height and setting it as the textview's frame height was enough, but it doesn't work on iOS 7.

How can i then create a UITextView with a fixed width, but dynamic height based on the text it's showing?

NOTE: I'm creating these views from code, not with Interface Builder.

Notice removed Current answers are outdated by Zoltan Varadi
Bounty Ended with Jordan Montel's answer chosen by Zoltan Varadi
Notice added Current answers are outdated by Zoltan Varadi
Bounty Started worth 50 reputation by Zoltan Varadi
Source Link
Zoltan Varadi
  • 2.5k
  • 3
  • 35
  • 51

iOS7 UITextView contentsize.height alternative

I'm porting one of apps from iOS 6.1 to iOS 7. I'm using a layout where there's a UITextView that has a fix width, but it's height is based on its contentsize. For iOS 6.1 checking the contentsize.height and setting it as the textview's frame height was enough, but it doesn't work on iOS 7.

How can i then create a UITextView with a fixed width, but dynamic height based on the text it's showing?

NOTE: I'm creating these views from code, not with Interface Builder.

Thanks in advance,

Zoli