【问题标题】:how to move from ViewController in iOS to Shared Page in Portable class library folder xamarin?如何从 iOS 中的 ViewController 移动到便携式类库文件夹 xamarin 中的共享页面?
【发布时间】:2017-08-18 05:32:12
【问题描述】:

我有一个视图控制器和一个按钮,单击该按钮时,我想移动到我的便携式类库文件夹中的共享页面?应用程序在单击按钮时崩溃。

  partial void UIButton75_TouchUpInside(UIButton sender)
    {
        var secondViewController = App.GetSecondPage().CreateViewController();
        NavigationController.PushViewController(secondViewController, true);
    }

GetSecondPage() 是我们 App.cs 中 Portable 文件夹中的一个方法,它指向共享页面。

 public static Page GetSecondPage()
    {
        var formsPage = new NavigationPage(new HomePage());

        return formsPage;
    }

【问题讨论】:

  • CreateViewController 中的代码是什么?
  • 我猜是iOS中使用的内置方法
  • 崩溃时抛出的异常是什么?您的 ViewController 是否包含在 UINavigationController 中?

标签: xamarin cross-platform


【解决方案1】:

我假设您想在特定平台上使用带有自定义设计元素的 Xamarin 表单。在 Forms 中设计所有页面(在可移植项目中),并使用渲染器为特定平台自定义元素。

或者您是否想通过视图控制器(来自 ios)解决表单中的页面无法解决的特定问题?

如果是这样,请在您需要的地方加载(便携式)应用程序(便携式应用程序),不一定在 AppDelegate cs 的 FinishLauching 方法中

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-28
    • 2018-02-13
    • 1970-01-01
    相关资源
    最近更新 更多