Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/44.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 在不同线程中拆分UIWebView加载和显示_Iphone_Multithreading - Fatal编程技术网

Iphone 在不同线程中拆分UIWebView加载和显示

Iphone 在不同线程中拆分UIWebView加载和显示,iphone,multithreading,Iphone,Multithreading,UIWebView是否可以加载本地html页面,然后在一个线程中运行javascript,然后在主线程中显示页面?伪代码如下: bool refresh; WebView* webView; void main() { newThreadStarts(); while(true) { if (refresh) { webView->Refresh(); } // a lot of other time-

UIWebView是否可以加载本地html页面,然后在一个线程中运行javascript,然后在主线程中显示页面?伪代码如下:

bool refresh;
WebView* webView;
void main() {
    newThreadStarts();
    while(true) {
        if (refresh) {
            webView->Refresh();
        }
        // a lot of other time-consuming code go here
        sleep(1000);
    }
}

void newThreadLoop() {
    webView->Load();
    while(true) {
        evaluateJavaScript();
        sleep(1000);
    }
}
ps:我是可可豆和iPhone开发的新手。

不:(

UIWebView执行javascript-UIWebView stringByEvaluatingJavascriptFromString:-的方式必须在主线程上运行,否则您的应用程序将很快崩溃

这里有一个类似的问题: