【问题标题】:Error to push a ViewController from other project从其他项目推送 ViewController 时出错
【发布时间】:2015-01-26 12:08:26
【问题描述】:

在第一个项目中,我有一个UIButton。当我触摸它时,将从另一个项目中打开其他UIViewController。但是我有一个问题:

这是我第一个项目的代码,我将用它来调用另一个项目中的其他UIViewcontroller

public partial class SomeSoluctionViewController : UIViewController
{
public SomeSoluctionViewController (IntPtr handle) : base (handle)
{
}

        public override void ViewDidLoad ()
            {
                base.ViewDidLoad ();
                PushedClassController pushedclass = PushedClass.AppDelegate.Storyboard.InstantiateViewController ("PushedClass") as PushedClassController;

                CallButton.TouchUpInside += (object sender, EventArgs e) => {
                    this.NavigationController.PushViewController (pushedclass, true);
                };

                // Perform any additional setup after loading the view, typically from a nib.
            }
    }

我按照 Xamarin 网站的指示使用 PushViewController

我用标识符实例化第二个类。

在 PushedClassController 的 AppDelegate 上:

public static UIStoryboard Storyboard = UIStoryboard.FromName ("MainStoryboard", null);

我在上面用过。

这是第二个项目的 pushView:

 namespace PushedClass
            {
              ** [Register ("PushedClass")]**
                public partial class PushedClassController : UIViewController
                {
                    public PushedClassController (IntPtr handle) : base (handle)
                    {
                    }
                }
            }

用“PushedClass”注册

日志:Objective-C 抛出异常。名称:NSInvalidArgumentException 原因:Storyboard () 不包含标识符为“PushedClass”的视图控制器

【问题讨论】:

    标签: c# ios uiviewcontroller xamarin pushviewcontroller


    【解决方案1】:

    在 xamarin 中打开推送的项目。

    点击底部的黑条,选择你想要显示的视图控制器。

    在身份下的设计师属性板中,为 Storyboard IDRestoration ID 指定唯一 ID 到 PushedClass

    【讨论】:

      猜你喜欢
      • 2011-10-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-29
      • 2013-01-07
      • 1970-01-01
      • 2013-12-18
      • 2019-04-16
      相关资源
      最近更新 更多