Iphone 如何修复自定义大小的MonoTouch对话框中使用EntryElement的滚动?

Iphone 如何修复自定义大小的MonoTouch对话框中使用EntryElement的滚动?,iphone,uitableview,uiviewcontroller,xamarin.ios,monotouch.dialog,Iphone,Uitableview,Uiviewcontroller,Xamarin.ios,Monotouch.dialog,我做了一些非常类似于这个问题的事情。我创建了一个MonoTouch DialogViewController,其中有一组EntryElements,用于为注册用户捕获信息。然后,我将此对话框ViewController添加到另一个UIViewController中: registerDialog = new RegisterDialog (); // the dvc registerDialog.View.Frame = new Rectangle

我做了一些非常类似于这个问题的事情。我创建了一个MonoTouch DialogViewController,其中有一组EntryElements,用于为注册用户捕获信息。然后,我将此对话框ViewController添加到另一个UIViewController中:

            registerDialog = new RegisterDialog (); // the dvc
            registerDialog.View.Frame = new RectangleF (0, 60, 320, View.Frame.Height - 60);
            registerDialog.TableView.BackgroundView = null; // make the background transparent
            Add (registerDialog.View);
当用户单击EntryElement时,问题就出现了。键盘显示出来,对于前几个EntryElements,一切都很好,因为键盘没有隐藏任何内容。当您浏览EntryElements时,DialogViewController不再在键盘上方滚动元素。基本上,DialogViewController的滚动会中断

这是由于将DialogViewController的视图添加到另一个视图中造成的。将DialogViewController推到UINavigationController上时,它可以正常工作:

NavigationController.PushViewController (new LoginScreen (), true);
这是一个bug还是有什么东西我可以覆盖来修复滚动

编辑 截图1: 带有一些EntryElements的DialogViewController。我已向下滚动到底部-姓氏上方有更多的EntryElements

截图2: 当我点击Email EntryElement时会发生什么。您可以非常清楚地看到DVC没有向上滚动表视图,而它通常会这样做


您可以尝试子类化DialogViewController类,而不是将DialogViewController视图添加到另一个视图中。如果你那样做的话,问题就会消失。我不知道这是否是一种很好的方法,但我在生产中成功地使用了它。我通常是这样做的,注意基本构造函数中的RootElement最初是空的,但是我们在ViewDidLoad中添加了内容

public class MyController : DialogViewController
{
    public MyController() : base(new RootElement(""), true)
    {
    }

    public override void ViewDidLoad() 
    {
        var section1 = new Section("Credentials") 
        {
            new EntryElement("Username", null, null),
            new EntryElement("Password", null, null)
        };

        Root.Add(section1);
       // additional initialization here
    }
}
此外,如果要在表单上方或下方添加内容,可以向节添加页眉和页脚-节类的HeaderView和FooterView属性