我正面临一个非常奇怪的问题。我正在尝试将UIbuttons添加到Monotouch中的UIscrollview。但UIbutton没有得到显示。无法添加UIbutton到单击动态中的UIscrollview动态
下面是代码:
UIImage img = UIImage.FromFile("ecu.png");
UIButton btn = UIButton.FromType(UIButtonType.Custom);
btn.SetBackgroundImage(img,UIControlState.Normal);
btn.Frame = new RectangleF(UIScreen.MainScreen.Bounds.Size.Width - 185, 0, 185,UIScreen.MainScreen.Bounds.Size.Height, 100, 150, 150);
btn.TouchUpInside += (sender, e) => {
UIAlertView alert = new UIAlertView("Info","Tapped",null,"Ok",null);
alert.Show();
} ;
scrollimages.AddSubview (btn);
相同的代码工作,如果我将按钮添加到视图。 我可以得到一些这方面的帮助。
您是否设置了UIScrollView.ContentSize? – 2013-04-05 09:16:17