0

and の行にUITableView触れると、myFunction操作を実行してからテーブルをリロードします。UIActivityIndicatorここで、を呼び出しているときにを表示したいと思いますmyFunction。これらの場合、どのようなアプローチが取られますか?

これは私のコードです:

-(void)collectionView:(UICollectionView*)collectionview didSelectItemAtIndexPath:(NSIndexPath*) indexPath {

[self showLoader];
[self performSelectorInBackground:@selector(myFunction:) withObject:indexPath];
[self hideLoader];
}
4

3 に答える 3

1

私はこのMBProgressHUDを使用することを好みます。

これは、データのロード中に UIActivityIndi​​cator を呼び出す良い例です。

于 2013-02-08T15:09:57.880 に答える
1

Call に Delay を追加します。

-(void)collectionView:(UICollectionView*)collectionview didSelectItemAtIndexPath:(NSIndexPath*) indexPath 
{
      [self showLoader];
      [self performSelector:@selector(myFunction:) withObject:indexPath afterDelay:1.0];
      [self hideLoader];
}

幸運を...!!!

于 2013-02-08T13:58:13.050 に答える
0

In This code UIActivityIndicatordisplay in statusBar

-(void)collectionView:(UICollectionView*)collectionview didSelectItemAtIndexPath:(NSIndexPath*) indexPath {

    [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];

    [self showLoader];
    [self performSelector:@selector(myFunction:) withObject:indexPath afterDelay:1.0];

    [self hideLoader];
    }

そして停止のUIActivityIndicatorために、最後に次のコードを書きますmyFunction

[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
于 2013-02-08T14:20:55.360 に答える