コード例 #1
0
        public PadView()
        {
            Assembly assembly  = typeof(PadView).Assembly;
            Stream   nibStream = assembly.GetManifestResourceStream(padViewNibResourceId);
            NSData   nibData   = NSData.FromStream(nibStream);
            NSNib    nib       = new NSNib(nibData, NSBundle.MainBundle);

            if (nib.InstantiateNibWithOwner(this, out NSArray nibObjects))
            {
                RootView           = GetPadViewFrom(nibObjects);
                RootView.presenter = CoverageExtension.Presenter(RootView);
            }
        }
コード例 #2
0
        static T InflateFromNibResource <T> (string name)
        {
            var asm = typeof(T).Assembly;

            ObjCRuntime.Runtime.RegisterAssembly(asm);

            NSData data;

            using (var stream = asm.GetManifestResourceStream(name)) {
                data = NSData.FromStream(stream);
            }

            var nib = new NSNib(data, NSBundle.MainBundle);

            nib.InstantiateNibWithOwner(null, out NSArray topLevelObjects);
            var arr = NSArray.FromArray <NSObject> (topLevelObjects);

            return(arr.OfType <T> ().Single());
        }