当前位置: 首页>>代码示例>>C#>>正文


C# UIViewController.WillMoveToParentViewController方法代码示例

本文整理汇总了C#中UIViewController.WillMoveToParentViewController方法的典型用法代码示例。如果您正苦于以下问题:C# UIViewController.WillMoveToParentViewController方法的具体用法?C# UIViewController.WillMoveToParentViewController怎么用?C# UIViewController.WillMoveToParentViewController使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIViewController的用法示例。


在下文中一共展示了UIViewController.WillMoveToParentViewController方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CycleFromViewControllerToViewController

        private void CycleFromViewControllerToViewController(UIViewController oldController,
                                                             UIViewController newController)
        {
            if (!MidTransition)
            {
                MidTransition = true;

                oldController.WillMoveToParentViewController(null);
                this.AddChildViewController(newController);

                // Whether this is a good UI choice aside, Scroll next UIViewController in from Right (alter as required for other transitions)
                RectangleF newControllerStartFrame =
                    new RectangleF(ContainerView.Frame.Location.X + ContainerView.Frame.Size.Width,
                                   ContainerView.Frame.Location.Y, ContainerView.Frame.Size.Width,
                                   ContainerView.Frame.Size.Height);
                RectangleF oldControllerEndFrame =
                    new RectangleF(ContainerView.Frame.Location.X - ContainerView.Frame.Size.Width,
                                   ContainerView.Frame.Location.Y, ContainerView.Frame.Size.Width,
                                   ContainerView.Frame.Size.Height);

                newController.View.Frame = newControllerStartFrame;

                // If you try to start another Container change whilst previous one is in the middle of an animation, you will get an error, such as -
                //   Unbalanced calls to begin/end appearance transitions for <NibViewController: 0xd503cc0>.
                //   Unbalanced calls to begin/end appearance transitions for <ProgrammaticViewController: 0x14d58c30 ..
                // Tried disabling UISegementedControl click to stop this happening but was jarring, so went for MidTransition variable.
                // ChooseVCUISegementedControl.Enabled = false;

                Transition(oldController, newController, 0.25, /*UIViewAnimationOptions.TransitionFlipFromLeft*/ 0,
                           () =>
                               {
                                   newController.View.Frame = oldController.View.Frame;
                                   oldController.View.Frame = oldControllerEndFrame;
                               }, delegate(bool finished)
                                   {
                                       oldController.RemoveFromParentViewController();
                                       newController.DidMoveToParentViewController(this);

                                       //ChooseVCUISegementedControl.Enabled = true;
                                       MidTransition = false;
                                   });
            }
        }
开发者ID:kentfonager,项目名称:ViewControllerContainer,代码行数:43,代码来源:ContainerViewController.cs

示例2: SwapChildView

        public virtual void SwapChildView(UIViewController newChildView, PanelType type)
        {
            if (newChildView == null)
                return;

            newChildView.View.Frame = CreateChildViewPosition();

            if (PanelView == null)
            {
                AddChildViewController(newChildView);
                View.AddSubview(newChildView.View);
            }
            else
            {
                AddChildViewController(newChildView);
                View.AddSubview(newChildView.View);
                newChildView.WillMoveToParentViewController(null);
                TransitionPanel(newChildView);
            }
        }
开发者ID:Brinium,项目名称:ThreeColumnContainer,代码行数:20,代码来源:PanelContainer.cs

示例3: HideContentController

 private void HideContentController(UIViewController content)
 {
     content.WillMoveToParentViewController(null);
     content.View.RemoveFromSuperview();
     content.RemoveFromParentViewController();
 }
开发者ID:kentfonager,项目名称:ViewControllerContainer,代码行数:6,代码来源:ContainerViewController.cs

示例4: HideViewController

 void HideViewController(UIViewController viewController)
 {
     viewController.WillMoveToParentViewController(this);
     viewController.View.RemoveFromSuperview ();
     viewController.RemoveFromParentViewController ();
 }
开发者ID:rid00z,项目名称:JellyBeanTracker,代码行数:6,代码来源:MRSideMenu.cs

示例5: ApplySideController

        private void ApplySideController(ref UIViewController controllerStore, UIViewController newController, UIViewController otherController, 
                                             Action clearOtherController)
        {
            Action<UIViewController> beforeBlock = (x) => {};
            Action<UIViewController, bool> afterBlock = (x, y) => {};

            if (this.viewAppeared)
            {
                beforeBlock = (controller) =>
                {
                    controller.View.RemoveFromSuperview();
                };

                afterBlock = (controller, left) =>
                {
                    controller.View.Hidden = left ? this.SlidingControllerView.Frame.Location.X <= 0 : this.SlidingControllerView.Frame.Location.X >= 0;
                    controller.View.Frame = this.ReferenceBounds;
                    controller.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
                    if (this.slidingController != null)
                    {
                        this.referenceView.InsertSubviewBelow(controller.View, this.SlidingControllerView);
                    }
                    else
                    {
                        this.referenceView.AddSubview(controller.View);
                    }
                };
            }

            // start the transition
            if (controllerStore != null)
            {
                controllerStore.WillMoveToParentViewController(null);
                if (newController == this.CenterController)
                {
                    this.CenterController = null;
                }

                if (newController == otherController && clearOtherController != null) clearOtherController();

                beforeBlock(controllerStore);

            //                controllerStore.setViewDeckController(null);
                controllerStore.RemoveFromParentViewController();
                controllerStore.DidMoveToParentViewController(null);
            }

            // make the switch
            if (controllerStore != newController)
            {
                // todo: dispose II_RELEASE(*controllerStore);
                controllerStore = newController;
            }

            if (controllerStore != null)
            {
                newController.WillMoveToParentViewController(null);
                newController.RemoveFromParentViewController();
                newController.DidMoveToParentViewController(null);

                // and finish the transition
                UIViewController parentController = (this.referenceView == this.View) ? this : this.GetGrandParent();
                if (parentController != null)
                {
                    parentController.AddChildViewController(controllerStore);
                }

            //                controllerStore.setViewDeckController(this);

                afterBlock(controllerStore, controllerStore == this.LeftController);

                controllerStore.DidMoveToParentViewController(parentController);
            }
        }
开发者ID:skela,项目名称:MonoKit,代码行数:74,代码来源:ViewDeckController.cs

示例6: RemoveViewController

		public void RemoveViewController(UIViewController viewController)
		{
			var item = _viewControllers.FirstOrDefault(x => x.Item1 == viewController);
			if (item == null)
				return;

			UIView.Animate(0.4, 0, UIViewAnimationOptions.CurveEaseInOut, () => {
				_isAnimating = true;
				//viewController.View.Alpha = 0;
				viewController.View.Frame = new RectangleF(0, View.Bounds.Height, View.Bounds.Width, 54);
				TabBarController.View.Frame = new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height);
			}, () => {
				_isAnimating = false;
				_viewControllers.Remove(item);
				viewController.WillMoveToParentViewController(null);
				viewController.View.RemoveFromSuperview();
				viewController.RemoveFromParentViewController();
			});
		}
开发者ID:pascalfr,项目名称:MPfm,代码行数:19,代码来源:MainViewController.cs


注:本文中的UIViewController.WillMoveToParentViewController方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。