添加新的视图控制器不会创建XIB文件

问题描述

我正在跟踪mvvmcross tutorial,其中说:

  1. 创建一个初始的UIViewController
  2. 创建一个名为Views的文件夹。
  3. 在其中添加一个新的“ View Controller”,并将其命名为TipView。

这将生成三个类:

  1. TipView.cs
  2. TipView.designer.cs
  3. TipView.xib

当我添加新的UIViewController时

When I add UIViewController

添加了以下两个没有xib文件的类。

namespace TipCalc.iOS.Views
{
    [Register("UniversalView")]
    public class UniversalView : UIView
    {
        public UniversalView()
        {
            Initialize();
        }

        public UniversalView(RectangleF bounds) : base(bounds)
        {
            Initialize();
        }

        void Initialize()
        {
            BackgroundColor = UIColor.Red;
        }
    }

    [Register("UIViewController1")]
    public class UIViewController1 : UIViewController
    {
        public UIViewController1()
        {
        }

        public override void DidReceiveMemoryWarning()
        {
            // Releases the view if it doesn't have a superview.
            base.DidReceiveMemoryWarning();

            // Release any cached data,images,etc that aren't in use.
        }

        public override void ViewDidLoad()
        {
            View = new UniversalView();

            base.ViewDidLoad();

            // Perform any additional setup after loading the view
        }
    }
}

将xib文件添加到与View Controller链接的正确方法是什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)