您的位置:首页 > 其它

如何在iPhone程序读取数据时显示进度窗

2009-06-22 14:13 621 查看
下面代码说明如何使用iPhone 非官方SDK在读取数据时显示进度条。 以下代码参考了MobileRss。 定义头文件: #import uikit/UIProgressHUD.h @interface EyeCandy : UIApplication { UIProgressHUD * progress; } - ( v
  

下面代码说明如何使用iPhone 非官方SDK在读取数据时显示进度条。

以下代码参考了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

上面的引号要改成<>。

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

使用下面代码调用:

// 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];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: