Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Scroll on iphone 4s

I'm writing an app that in the main view has 6 imageViews and i added constraints for the different sizes, i want my elements to have no space in the side so the width will change depending on the size of the display, the height is set in the ratio to the width that changes.

the problem is that for iPhone 4s one element and a half of other gets out of the viewport but i don't know how to enable the scroll for that case.

i don't know if it's disabled but when i run the simulator i cannot "simulate" the scroll event (click and drag) i mean when i do this nothing happen

thanks!

2 Answers

I am sure there are more effective ways to solve this, but as i´m still new to iOS development myself, i use either a static table or, my preference, Auto Layout to adjust the view for every single device. If you adjust everything so it fits perfectly on, let´s say, an iphone 4s or 5s, then you will have a lot of empty space on iphone 6 and 6plus. So i prefer to make a layout for every device size.

I look forward to see how more experienced developer solve this ;-)

the solution i found was to use a scroll view and then a view so that each content can be scrollable, the scroll view has constraints of 0 to each side and top and bottom, the view has also 0 to top, bottom and sides but has equal heights and widths with the main view controller so each render changes the size and makes it scrollable

hope it's easy to understand thanks