Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make my UIView Scrollable

I know that I have to insert a UIScrollView in my UIView and in my viewLoad put the sizeContent of my IBOutlet UIScrollView, but I have some doubts because it doesn't work for me, I guess that there is some information missing for me.

My UIView size is 320x678, so I need to scroll it down/up vertically, I googled but some methods but always crash or doesn't work, I deploy target to iOS 4.3 in order that my app work for all iOS >= 4.3, and I'm at this point that need help to clarify my mind...

What steps should I take from the begining to the end? and the scroll view should be on the foreground or background of all controller?

EDIT: I did this....

|-button-||-imgview-||-button-| |-some-|
|-------scrollview content size--------|  Size = 320x678
|--------------scrollview--------------|  Size = 320x678
|----------------view------------------|  Size = 320x678

And probabbly that's my mistake, but, why I cannot make my iPhone scrollable?

|-----iPhone screen-----|
|-------------My app------------|

If I don't do any kind of trick to scroll I won't see more than my iPhone screen, there is not any autoscroll for that kind of "problems"? or I have to do that you told me?

Because now my problem is that I have to rebuild my .xib and I really don't understand how to do it, the theory I understand but not how to.

EDIT2:

I fixed following your theory.

1.- I created a Iphone screen 3.5
2.- I created an auxiliar view with freeform and adapted to 320x678
3.- I designed my 320x678 view
4.- In my main .xib I added my scroll IBOutlet and in the IB then linked.
5.- On my loadview I added the sizecontent
6.- I dragged to my 3.5 screen all the content from my auxiliar window.. then I deleted the auxiliar window.

Thanks.

like image 959
Alejandro L. Avatar asked Apr 25 '26 15:04

Alejandro L.


1 Answers

I think you've got your scroll view ideas the wrong way around.

In order to use a scroll view you add it to a view that doesn't scroll. i.e. yourViewController.view. Then you add the content into your scrollView and set the contentSize of the scrollView.

The ScrollView contains its own view that does the scrolling.

i.e.

|-button-|     |-button-|    |--label--|
|-------scrollview content size--------|  Size = 320x678
|--scrollview----|   Size = 320x480
|------view------|   Size = 320x480

This will then show one and a half buttons but allow you to scroll so you can see the label too.

I hope this makes sense.

like image 184
Fogmeister Avatar answered Apr 28 '26 04:04

Fogmeister



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!