LoadingOverlay loadingOverlay = new LoadingOverlay (UIScreen.MainScreen.Bounds);
方法一、针对视图或视图控制器的单体对象操作:
UIApplication.SharedApplication.Windows.Last ().AddSubview (loadingOverlay);方法
方法二、针对父容器操作:
tabBarController.ViewControllerSelected+= delegate(object sender1, UITabBarSelectionEventArgs e) {......}
ViewControllerSelected事件中添加遮罩:
this.NavigationController.View.AddSubview (loadingOverlay);
移除,异步线程中处理。
针对一的移除,直接处理就行:
if (loadingOverlay != null) {
loadingOverlay.Hide ();
loadingOverlay.Dispose ();
}
================分割线=================
针对二的移除,需要遍历父级容器找到目标然后移除:
var qv = from t in this.NavigationController.View.Subviews
where t is LoadingOverlay
select t;
if (qv.Count () > 0)
((UIView)qv.First ()).RemoveFromSuperview ();
推荐使用第一种方法,另外可以研究下UIApplication.SharedApplication对象,应该是个单例对象
PS:LoadingOverlay的源码参考:http://blog.csdn.net/joyhen/article/details/17222117