ios webview 中 載入狀態顯示兩種方法

2021-06-09 20:36:58 字數 1507 閱讀 1657

第一種方法:

//建立uiwebview  

webview = [[uiwebview alloc] initwithframe:cgrectmake(0, 44, 320, 400)]; 

[webview setuserinteractionenabled:no]; 

[webview setbackgroundcolor:[uicolor clearcolor]];   

[webview setdelegate:self];   

[webview setopaque:no];//使網頁透明  

nsstring *path = @"";  

nsurl *url = [nsurl urlwithstring:path];  

[webview loadrequest:[nsurlrequest requestwithurl:url]]; 

//建立uiactivityindicatorview背底半透明view   

uiview *view = [[uiview alloc] initwithframe:cgrectmake(0, 0, 320, 480)];  

[view settag:103]; 

[view setbackgroundcolor:[uicolor blackcolor]];

[view setalpha:0.8]; 

[self.view addsubview:view];  

activityindicator = [[uiactivityindicatorview alloc] initwithframe:cgrectmake(0.0f, 0.0f, 32.0f, 32.0f)]; 

[activityindicator setcenter:view.center]; 

[activityindicator setactivityindicatorviewstyle:uiactivityindicatorviewstylewhite];   

[view addsubview:activityindicator];  

[self.view addsubview:webview];   

[view release]; 

[webview release];  

//以下兩個方法是uiwebview的delegate methods

//開始載入資料

- (void)webviewdidstartload:(uiwebview *)webview  

//資料載入完   

- (void)webviewdidfinishload:(uiwebview *)webview

第二種方法:在uialertview上新增乙個uiactivityindicatorview

//載入網頁動畫 

- (void)webviewdidstartload:(uiwebview *)webview

}- (void)webviewdidfinishload:(uiwebview *)webview

Apache中載入PHP,PHP中載入MySQL

apache安裝 php安裝 mysql安裝 1.開啟c software zdyhj apache24 conf httpd.conf,在loadmodule處加入 在apache中以module的方式載入php php7 module指php的版本號 loadmodule php7 module...

ios webView去載入靜態的html

直接上 獲取webview uiwebview webview uiwebview self.view 設定 webview.delegate self 建立乙個url物件,和pathforresource差不多前面是檔名,後面是字尾 nsurl url nsbundle mainbundle ur...

Android 中載入延時載入動畫

我們現在應用程式載入之前一般都有splash。我們今天就用乙個例項來給大家講述一下splash。在應用程式載入之前一般都有splash。源 如下 package com.easyway.splash import com.easyway.splash.r import android.content...