1

「購入」ボタンと一緒に uitableview に表示される曲のタイトルのリストがあります。そのボタンがタップされると、MBProgressHUD が表示されます。

しかし、MBProgressHUD が時々表示されないのはなぜですか?

教えてください、どうもありがとう。

以下はコードです

-(void) buySong:(UIButton *)button
    {
      self.view.userInteractionEnabled = NO;

      self.navigationController.navigationBar.userInteractionEnabled = NO;

      MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
      hud.labelText = @"Proessing...";
      hud.yOffset = -80;

      UITableViewCell *cell = (UITableViewCell *)[[button superview] superview];
      NSIndexPath *indexPath = [[self tblViewChildrenPoems] indexPathForCell:cell];

      PSSongTags *songTags = [self.songsArray objectAtIndex:indexPath.row];
      [ [PurchaseViewController sharedPurchaseManager] startPurchase:songTags];

    }
4

1 に答える 1

2

このコードを試してみてください...

.h ファイルに .h ファイルをインポートします。

 #import "MBProgressHUD.h"

デリゲートを設定します。

MBProgressHUDDelegate

MBProgressHUD *HUD;

.m ファイルで // 表示したい場所にこのコードを追加します ...

HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
    [self.navigationController.view addSubview:HUD];
    HUD.delegate = self;
    HUD.labelText = @"Authorizing...";
    [HUD show:YES];

そして、プロセスが非表示の使用を終了すると..

[HUD Hide:YES];

mファイルにも非表示デリゲートを設定します..

- (void)hudWasHidden:(MBProgressHUD *)hud {
    // Remove HUD from screen when the HUD was hidded
    [HUD removeFromSuperview];
    [HUD release];
    HUD = nil;
}

幸せなコーディング...

于 2012-09-03T04:45:37.810 に答える