I'm using a UIScrollView for the first time, and I'm going crazy. I have several text boxes and labels开发者_StackOverflow中文版 on the scrollview. My text box event handled for TouchedDown, HandleTbLocationTouchDown (tb = Textbox), isn't firing half the time. My guess would be that the scrollview is swallowing the event because I have the exact same functionality on another View and it works perfectly fine.
Also, I set the size of the ScrollView in IB but that doesn't let it be scrollable. Setting it programmatically in my ViewDidLoad works though.
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Set the scrollableview
scrollView.Frame = new RectangleF(0,20, 320, 460);
// Set the initial scrollable view area size
scrollView.ContentSize = new SizeF(320, 550);
// For some reason this isn't always firing to do the offset,
// but the keyboard ALWAYS comes up.
tbLocation.TouchDown += HandleTbLocationTouchDown;
}
void HandleTbLocationTouchDown (object sender, EventArgs e)
{
scrollView.SetContentOffset(new PointF(0, 130), true);
}
Help?
精彩评论