Forum Xamarin.iOS

How can I make my a scroll view automatically adjust to different screen sizes?

MoussaElChaterMoussaElChater USMember
edited July 2015 in Xamarin.iOS


I have a view where the user have multiple fields to fill out and a button at the bottom.
I have a Scroll view added to that view, and an Image that I use as a background and set it to be scale to fill.
what I am trying to do is have my scroll view adjust automatically to different screen sizes. So mainly on iphone 6, there will be no scrolling required, whereas on an iphone 4, the user will have to scroll.
I have been stuck on this issue for a few weeks now, so please if anyone can help I would appreciate it...or if you can point me to the right direction.

I tried setting my constraints in different ways, where the scroll view is bound by the main view, and the image bound by the scroll view, but I always end up with the scrolling being way too much than what I need.

I also tried doing this in code with still no luck, I tried setting the image size to be a fixed size with limited success, as it does not work the way I wanted on smaller screens, only the screen I use to set the size to be constant on, on smaller screen I can scroll but more than I need :

this.BookingScrollView.ContentSize = new CGSize (View.Bounds.Width, this.MakeReserv.Bounds.Y + this.MakeReserv.Bounds.Height + 30);

I would really appreciate the help...Thanks!!


  • This whole scrollview fit to screen topic is really complicated in IOS. I first thought "well I will do my GUI native so its easier", bu after days of trying I ended up using Xamarin Forms. In Xamarin Forms its actually easy, define a scrollview fullscreen and put some stuff inside.

    I dont have example code at hand,, there should be some on this homepage. Let me know if you run into trouble with it.

Sign In or Register to comment.