3

ある UITableView1 から別の UITableView2 に移動するときにアクティビティ インジケーターを表示し、テーブルが完全に読み込まれると停止します。

XML 解析を使用して、UITableView2 のセル コンテンツを取得しています。

4

1 に答える 1

8

次のコードはあなたを助けるかもしれません...

UITableView2 の .h ファイル:

変数を宣言する

UIActivityIndicatorView *progressInd;

プロパティを作成する

@property (nonatomic, retain) UIActivityIndicatorView *progressInd;

メソッドの宣言

- (UIActivityIndicatorView *)progressInd;

UITableView2 の .m ファイル:

@synthesize progressInd;

このメソッドを定義します (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;
}

- (void)viewDidLoad解析が開始するメソッドで

[self.view addSubview:self.progressInd];

解析が終了する次の行を使用します

[self.progressInd removeFromSuperview];
于 2010-01-28T10:16:01.277 に答える