Pregunta

I've been trying to make my scrollview correctly fit it's content which includes a label, UIImageView, and textview. The textview sizes dynamically to different text, so I've made the scrollview's content size the same as the textview's:

sview.contentSize = (tview.contentSize);

That worked as expected, so my scrollview is close to the size I want, but I need to just add a static 180 pixels or so to make up for the label and image, which don't change size. I would guess it's an easy 1 or 2 lines of code but I can't figure it out. I've tried:

sview.contentSize += 180;

and

CGRect extra;
extra.size.height = 180;
sview.contentSize += extra.size;

and several other combinations to try to make it work but I keep getting errors like Lvalue required as left operand of assignment, or invalid operands to binary +. I'm sure I'm missing an easy solution, thanks for any help.

¿Fue útil?

Solución

sview.contentSize = CGSizeMake(sview.contentSize.width, sview.contentSize.height+180);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top