开发者

Inconsistent text field.TouchDown firing when using a ScrollView

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜