本文整理汇总了C#中UIWindow.RemoveFromSuperview方法的典型用法代码示例。如果您正苦于以下问题:C# UIWindow.RemoveFromSuperview方法的具体用法?C# UIWindow.RemoveFromSuperview怎么用?C# UIWindow.RemoveFromSuperview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIWindow
的用法示例。
在下文中一共展示了UIWindow.RemoveFromSuperview方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowTopNoti
public void ShowTopNoti(Xamarin.Forms.Page page, Xamarin.Forms.View noti, int ttl = 1500)
{
if (noti != null && page != null) {
var render = Convert(noti, page);
if (render != null) {
nfloat width = XFPopupConst.SCREEN_WIDTH;
var size = noti.GetSizeRequest(XFPopupConst.SCREEN_WIDTH - 4, XFPopupConst.SCREEN_HEIGHT * 0.2f);
nfloat height = (int)size.Request.Height;
if (height > (XFPopupConst.SCREEN_HEIGHT * 0.2f))
{
height = (int)(XFPopupConst.SCREEN_HEIGHT * 0.2f);
}
//important
noti.Layout(new Xamarin.Forms.Rectangle(0, 0, width, height));
var win = new UIWindow(new CGRect(0,0,width,height));
win.WindowLevel = UIKit.UIWindowLevel.Alert;
var native = render as UIKit.UIView;
win.AddSubview (native);
win.Alpha = 0;
win.MakeKeyAndVisible ();
native.Frame = new CGRect(1, 0 , width - 2, 0) ;
win.Alpha = 1;
UIView.Animate (
duration: 1f,
delay: 0f,
options: UIViewAnimationOptions.TransitionNone,
animation: () => {
native.Frame = new CoreGraphics.CGRect (1, 20, width - 2, height - 2);
},
completion: () => {
UIView.Animate(
duration: ttl/1000,
delay: 0f,
options: UIViewAnimationOptions.CurveEaseInOut,
animation: () => { win.Alpha = 0; },
completion: () => {
native.RemoveFromSuperview();
native = null;
win.RemoveFromSuperview();
win = null;
}
);
}
);
}
}
}