我面临一个非常奇怪的问题。我正在尝试将 UIbuttons 添加到 Monotouch 中的 UIscrollview 中。但是 UIbutton 没有显示出来。
这是代码:
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);
如果我将按钮添加到视图,相同的代码将起作用。我能得到一些帮助吗?