本文整理汇总了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;
});
}
}
示例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);
}
}
示例3: HideContentController
private void HideContentController(UIViewController content)
{
content.WillMoveToParentViewController(null);
content.View.RemoveFromSuperview();
content.RemoveFromParentViewController();
}
示例4: HideViewController
void HideViewController(UIViewController viewController)
{
viewController.WillMoveToParentViewController(this);
viewController.View.RemoveFromSuperview ();
viewController.RemoveFromParentViewController ();
}
示例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);
}
}
示例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();
});
}