3

I'm using Xamarin Auto Layouts with Storyboard on Visual Studio 2015.

I have a root view, Scroll View and Content View.

I want the application to only scroll on the y-axis but scale on the x-axis.

I want to do something like this.

Adding a view to a scroll view that will stretch to fill available width

Which is setting the width of the content view to the root view.

But using Xamarin this does not seem possible.

Not able to do the same things that xcode does.

X axis doesn't scale down

So in this example, if I run the application, I have to scroll to the right to see the right most label. I want all three labels to show up on the iPhone, by scaling down on the x-axis.

I have also tried using the "I" handle on the content view in storyboard UI Designer of Xamarin VS, but it doesn't identify the root view.

If it's not possible using storyboard, I will settle with code.

I have tried this.

    public override void ViewDidLoad()
    {

        ContentView.Frame = new CoreGraphics.CGRect(ContentView.Frame.X, ContentView.Frame.Y, View.Frame.Width, ContentView.Frame.Height);
        //ScrollView.TranslatesAutoresizingMaskIntoConstraints = false;
        base.ViewDidLoad();

        // Perform any additional setup after loading the view, typically from a nib.
    }

But it doesn't do anything to help me.

How can I scale the UI down on the X-axis while on top of a scroll view using Xamarin.ios?

Community
  • 1
  • 1
mac10688
  • 2,145
  • 2
  • 24
  • 37
  • This is possible using a storyboard. Are you wanting the labels at the top not to move with the scrollView? If so I would move them out of the scrollview also it will be the +43 constraint you have on the leading edge of the first label to the next label, that will push it out. – Iain Smith Aug 25 '15 at 15:32
  • I would say I want the labels to move with the scroll view on the y-axis. So I don't think moving them out of the scrollview is what I want to do. You are right that the +43 constraint will push the labels out but the constraint should scale based on screen size right? I did a practice demo without having a scrollview and the x-axis scaled fine. – mac10688 Aug 25 '15 at 15:42
  • add layout constraint for iphone in portrait / landscape, highly recommend using XCode inreface builder for this :) – Milen Aug 25 '15 at 16:22

0 Answers0