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