uiscrollview - iOS fixed width ScrollView -


i want achieve following auto layout.

--------------------- |                   | |                   | |                   | |    scrollview     | |                   | |                   |  |                   | |                   |  --------------------- |                   | |     content       | |                   | --------------------- 

the scrollview has width equal screen size , content inside scrollview extends screen. not want user able scroll horizontally.

i have tried

  1. put view inside of scrollview , set both of them have leading, trailing, top, , bottom constraints 0. try dynamically set width of content , scrollview screensize.

  2. simply surround page's content in scrollview set have leading, trailing, top, , bottom constraints 0. try dynamically set width of scrollview screensize.

both of following result in this...

enter image description here

notice how centered horizontally have set be, yet horizontal scrollbar present , can scroll blank screen.

you set wrong content size scrollview , hence scrolling horizontally.

scrollview.contentsize = cgsizemake(scrollview.frame.size.width, sizeofcontent); 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -