vs2017 ios开发中遇到的问题

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();

  

posted @ 2018-06-04 22:28  第一序列  阅读(141)  评论(0编辑  收藏  举报