Hi,
I want to create a screen like the application of BBC News, which has horizontal and vertical scroll.
Namely can ride up and down within each category can walk sideways.
Create vertical scrolls is easy, basically I'm using this code
List<UIButton> _buttons = new List<UIButton> (); float h = 90.0f; float w = 90.0f; float padding = 15.0f; int n = 25; var _scrollView = new UIScrollView { Frame = new RectangleF (0, 80, View.Frame.Width, h + 4 * padding), ContentSize = new SizeF ((w + padding) * n, h), AutoresizingMask = UIViewAutoresizing.FlexibleWidth }; for (int i=0; i<n; i++) { var button = UIButton.FromType(UIButtonType.Custom); button.SetImage (UIImage.FromFile ("teste.jpg"), UIControlState.Normal); button.Frame = new RectangleF (padding * (i + 1) + (i * w), padding, w, h); UILabel otherTextField = new UILabel (new System.Drawing.RectangleF (0, w + 10f , w, 12f)); otherTextField.AdjustsFontSizeToFitWidth = true; otherTextField.TextColor = UIColor.Black; otherTextField.Text = "Testing"; button.AddSubview (otherTextField); _scrollView.AddSubview (button); _buttons.Add (button); } this.View.AddSubview (_scrollView);
How can I create a list of scrolls vertical with horizontal scroll?
Best Regards
Posts
To create a vertical-only scroll you simply have to set the content size's width to zero.
To create a horizontal-only scroll you simply have to set the content size's height to zero.
iOS handles nested scrolls automatically, you don't need to code anything else.
@GuillermoGutierrez Thanks!