3
我想要在将一个UITableView1导航到另一个UITableView2时显示活动指示灯,并在表完全加载时停止。从UITableView1导航到UITableView2时应显示活动指示灯
我正在使用XML解析来获取UITableView2的单元格内容。
我想要在将一个UITableView1导航到另一个UITableView2时显示活动指示灯,并在表完全加载时停止。从UITableView1导航到UITableView2时应显示活动指示灯
我正在使用XML解析来获取UITableView2的单元格内容。
下面的代码可以帮助你......
在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];
谢谢。它工作正常。 – Warrior 2010-01-28 10:36:12