2016-06-21 134 views
0

我创建了一个scrollview动态和UIViews动态创建populei。 这是一个日历,其中每个月都是放置在scrollview上的视图,问题在于不起作用。 任何人都可以帮助解决? 非常感谢您UIScrollView不滚动使用uiview

double larguraTela     = UIScreen.MainScreen.Bounds.Width * 0.01; 
     scrollView       = new UIScrollView(new CGRect((nfloat)larguraTela * 3, 105, (nfloat)larguraTela * 94, UIScreen.MainScreen.Bounds.Height-110)); 
     scrollView.BackgroundColor   = UIColor.FromRGB(60, 60, 60); 
     scrollView.ScrollEnabled   = true; 
     scrollView.UserInteractionEnabled = true; 

     View.AddSubview(scrollView); 
     scrollView.AddSubview(Calendario(1)); 
     scrollView.AddSubview(Calendario(2)); 
     scrollView.AddSubview(Calendario(3)); 
    } 

public UIView Calendario(int mes)
{
 UIView local   = new UIView(new CGRect(0, altura, scrollView.Frame.Width, 185));
   local.BackgroundColor = UIColor.FromRGB(60, 60, 60); 

... 回本地; }

enter image description here

回答

1

您需要设置滚动视图的ContentSize。如果您使用约束,只要存在底部约束,它应该自动执行。如果不是,您需要明确设置ContentSize以适合内容

+0

非常感谢您 –