Question

In the DetailView of my SplitViewController, I placed several UIViews as containers for different flat TableViews. So far my intention. To keep things simple, I wanted to add DialogViewControllers (MvxDialogViewControllers to be honest, but that didn't work) to these SubViews. My problem is, that the Dialogs overlap their container and "use" more space, then they should (I can see the default grey background around the container views).

Since I thought the frame of the DialogViewController depends on the dimension of its parents frame, I am little bit confused. I create and add the DVC like this (ParentViewController derives from MvxViewController):

public partial class DetailView : BaseView
{               
public override void ViewDidLoad ()
{
    base.ViewDidLoad ();

    CreateVisitContextController();
    // ...
}

private void CreateVisitContextController()
{
    var root = new RootElement("Test")
    {
        new Section("Section1"),
        new Section("Section2")
    };

    var dialogViewController = new DialogViewController(root);
    VisitContextContainer.AddSubview(dialogViewController.TableView);
}

Any hint or assistance would really be appreciated. Perhaps this is totally the wrong direction?

One remark: I designed the DetailView and the corresponding container SubViews in IB.

When I use DialogViewController without inheriting from MvxDialogViewController, will I still be able to bind to the Dialog Elements?

Thanks in advance and have a nice evening!

Was it helpful?

Solution

"use" more space, then they should

It's worth spending some time to look at uikit and how it works. A uiview does not always auto-resize to its container.

There are quick fixes like q&a's here like: Makeing view resize to its parent when added with addSubview - but it might be better to start from the apple uikit reference - http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKit_Framework/_index.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top