1. 有时候关闭webview子页面的时候会出错。一般是因为线程的问题
try
{ //有时候在并行编程中,通过ui主线程来处理并不能够奏效,这时候需要通过禁用UI线程,这样就不会出错: var previous = UIApplication.CheckForIllegalCrossThreadCalls; UIApplication.CheckForIllegalCrossThreadCalls = false;mainWebView.ViewWithTag(99).RemoveFromSuperview();
UIApplication.CheckForIllegalCrossThreadCalls = previous;
}
catch (Exception ex) { //在主线程更新UI操作 InvokeOnMainThread(() => { mainWebView.ViewWithTag(99).RemoveFromSuperview(); }); }2. alert提示框
UIAlertView messageBox = new UIAlertView("提示", "你点击了一个按钮", null, "Close", "OK"); messageBox.Clicked += (caller, buttonArgs) => { Console.Write("qqqqqqqq"); }; messageBox.Show();