2010-01-28 72 views

回答

7

下面的代码可以帮助你......

在UITableView2的.h文件中:

声明变量

UIActivityIndicatorView *progressInd; 

创造财产

@property (nonatomic, retain) UIActivityIndicatorView *progressInd; 

和申报方法

- (UIActivityIndicatorView *)progressInd; 
在UITableView2的.m文件

@synthesize progressInd; 

- (void)viewDidLoad方法定义该方法(调整X,Y,宽度,宽度的位置)

- (UIActivityIndicatorView *)progressInd { 
if (progressInd == nil) 
{ 
    CGRect frame = CGRectMake(self.view.frame.size.width/2-15, self.view.frame.size.height/2-15, 30, 30); 
    progressInd = [[UIActivityIndicatorView alloc] initWithFrame:frame]; 
    [progressInd startAnimating]; 
    progressInd.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; 
    [progressInd sizeToFit]; 
    progressInd.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | 
            UIViewAutoresizingFlexibleRightMargin | 
            UIViewAutoresizingFlexibleTopMargin | 
            UIViewAutoresizingFlexibleBottomMargin); 

    progressInd.tag = 1; // tag this view for later so we can remove it from recycled table cells 
} 
return progressInd; 
} 

在您的解析开始

[self.view addSubview:self.progressInd]; 

使用以下行解析结束处

[self.progressInd removeFromSuperview]; 
+0

谢谢。它工作正常。 – Warrior 2010-01-28 10:36:12