iPhone程序讀取數(shù)據(jù)時(shí)顯示進(jìn)度窗
作者:佚名
本文介紹的是iPhone程序讀取數(shù)據(jù)時(shí)顯示進(jìn)度窗,詳細(xì)講述了如何實(shí)現(xiàn)的,先來看內(nèi)容。
iPhone程序讀取數(shù)據(jù)時(shí)顯示進(jìn)度窗是本文要介紹的內(nèi)容,如何在iPhone程序讀取數(shù)據(jù)時(shí)顯示進(jìn)度窗?先來看內(nèi)容。
下面代碼說明如何使用iPhone 非官方SDK在讀取數(shù)據(jù)時(shí)顯示進(jìn)度條。
以下代碼參考了MobileRss。
定義頭文件:
- #import "uikit/UIProgressHUD.h"
- @interface EyeCandy : UIApplication {
- UIProgressHUD *progress;
- }
- - (void) showProgressHUD:(NSString *)label withWindow:(UIWindow *)w withView:(UIView *)v withRect:(struct CGRect)rect;
- - (void) hideProgressHUD;
- @end
上面的引號(hào)要改成<>。
- import "EyeCandy.h"
- @implementation EyeCandy
- - (void)showProgressHUD:(NSString *)label withWindow:(UIWindow *)w withView:(UIView *)v withRect:(struct CGRect)rect
- {
- progress = [[UIProgressHUD alloc] initWithWindow: w];
- [progress setText: label];
- [progress drawRect: rect];
- [progress show: YES];
- [v addSubview:progress];
- }
- - (void)hideProgressHUD
- {
- [progress show: NO];
- [progress removeFromSuperview];
- }
- @end
使用下面代碼調(diào)用:
- // Setup Eye Candy View
- _eyeCandy = [[[EyeCandy alloc] init] retain];
- // Call loading display
- [_eyeCandy showProgressHUD:@"Loading …" withWindow:window withView:mainView withRect:CGRectMake(0.0f, 100.0f, 320.0f, 50.0f)];
- // When finished for hiding the "loading text"
- [_eyeCandy hideProgressHUD];
小結(jié):iPhone程序讀取數(shù)據(jù)時(shí)顯示進(jìn)度窗的內(nèi)容介紹完了,希望本文對(duì)你有所幫助!
責(zé)任編輯:zhaolei
來源:
互聯(lián)網(wǎng)