我有在uitableview中显示的歌曲标题列表,以及点击"Buy“button.when按钮,我正在显示MBProgressHUD.But,有时它不是displayed.also,它禁用用户交互,如下代码所示。
但是为什么它有时不显示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];
}发布于 2012-09-03 04:45:37
试试这个密码也许能帮你..。
在.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;
}快乐的编码..。
https://stackoverflow.com/questions/12241914
复制相似问题