工具栏在自定义UIViewController中不可见

时间:2012-05-21 16:02:19

标签: ipad xcode4 xamarin.ios monodevelop

我正在使用monotouch for iPad创建主细节应用程序。在我添加的主视图中,自定义了UIViewController。这个UIViewController在顶部有一个工具栏和2个UITableView。我只能看到第一个UITableView。我无法在底部看到工具栏和其他UItableView。

我不确定是否需要打开任何内容或配置任何内容以启用可见性。

我为每个表格视图和工具栏创建了插座。

如果有人能对此有所了解,我将不胜感激。

请看图片。

enter image description here

由于

Balan Sinniah

更新:我有AppDelegate代码,如下所示

[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
    // class-level declarations
    UIWindow window;
    UISplitViewController splitViewController;


    public override bool FinishedLaunching (UIApplication app, NSDictionary options)
    {
        // create a new window instance based on the screen size
        window = new UIWindow (UIScreen.MainScreen.Bounds);

        var controller = new RootViewController ();

        var navigationController = new UITabbedViewController();
        var detailViewController = new UIDetailViewTabbedBarController();
        splitViewController = new UISplitViewController ();
        splitViewController.WeakDelegate = detailViewController;
        splitViewController.ViewControllers = new UIViewController[] {
            navigationController,
            detailViewController
        };

        window.RootViewController = splitViewController;
        navigationController.DetailViewController = detailViewController;
        // make the window visible
        window.MakeKeyAndVisible ();

        return true;
    }
}

我的导航控制器是UITabbedView控制器,它有2个UIViewController。我在其中一个UIViewController中添加了工具栏和2个表视图。

2 个答案:

答案 0 :(得分:3)

我通过调整界面构建器中的自动调整部分来实现它,标记左,右和上面的红线并取消标记底部的红线,然后一切看起来都很好。

我为UITableView做了同样的事情,我在顶部标记了红线。

答案 1 :(得分:1)

对于工具栏,请尝试在uiviewcontroller上实现此功能 (它可以是另一种方式(第一个是假的,第二个是真的)

public override void ViewWillAppear (bool animated) {
        base.ViewWillAppear (animated);
        this.NavigationController.SetNavigationBarHidden (true, animated);
    }

    public override void ViewWillDisappear (bool animated) {
        base.ViewWillAppear (animated);
        this.NavigationController.SetNavigationBarHidden (false, animated);
    }

对于该表,2个tableview是否列在彼此之下? (在viewbuilder中,第一个tableview不太高,它会在运行应用程序时自动适应数据量)