简体   繁体   中英

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.

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. ie 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.

ie

|-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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM