ios - MBProgress HUD 没有显示正确的模式总是默认模式

标签 ios ios5 uiviewcontroller viewcontroller mbprogresshud

我正在尝试使用一种模式初始化 MBProgress HUD,但弹出的进度仅带有标签而不是环形模式。

    //Addition of new HUD progress whilst running the process field entries method
    HUD = [[MBProgressHUD alloc] initWithView:self.view];
    [self.view addSubview:HUD];

    // Set determinate mode
    HUD.mode = MBProgressHUDModeAnnularDeterminate;

    HUD.delegate = self;
    HUD.labelText = @"Signing you up";

    // myProgressTask uses the HUD instance to update progress
    [HUD showWhileExecuting:@selector(processFieldEntries) onTarget:self withObject:nil animated:YES];

我还在委托(delegate)行上收到警告。

Assigning to 'id<MBProgressHUDDelegate>' from incompatible type 'NewUserViewController *const __strong'

///

这是另一个例子 - HUD-test 是一个简单的应用程序,我设置它来显示完整的代码和问题(第二张图片) \\

///

最佳答案

为了消除警告,只需在头文件中将类定义为 MBProgressHUDDelegate。

要注意正确的模式,请查看 MBProgressHUD.h 模式枚举:

/** Progress is shown using an UIActivityIndicatorView. This is the default. */
MBProgressHUDModeIndeterminate,
/** Progress is shown using a round, pie-chart like, progress view. */
MBProgressHUDModeDeterminate,
/** Progress is shown using a ring-shaped progress view. */
MBProgressHUDModeAnnularDeterminate,
/** Shows a custom view */
MBProgressHUDModeCustomView,
/** Shows only labels */
MBProgressHUDModeText

选择您要显示的那个并使用此代码激活:

   MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; 
    [HUD setMode: MBProgressHUDModeAnnularDeterminate]; 
    HUD.delegate = self; 
    HUD.labelText = @"Signing you up"; 
    [HUD showWhileExecuting:@selector(processFieldEntries) onTarget:self withObject:nil animated:YES];

关于ios - MBProgress HUD 没有显示正确的模式总是默认模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12177777/

相关文章:

ios - "IN"NSPredicate 在对象数组中进行搜索

iphone - 配对dispatch_resume和dispatch_suspend以强制终止应用程序

objective-c - 将 NSString TO NSNumber 准确转换为十进制

ios - 在另一个 ViewController 中显示和切换 ViewController

ios - Swift 2.1 中的 NSClassFromString

ios - 如何将 RootViewController 更改为另一个 XIB?

ios -/app/app_link_hosts 图形 API 在 iOS 中不适用于我

ios - Web View 非法接口(interface)限定符

ios - 在 Xcode 5 中重命名 iOS 项目

objective-c - UIProgressView 和自定义轨迹和进度图像(iOS 5 属性)