2

我正在尝试使用一种模式来初始化 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];

我也在代表行收到警告。

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

///

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

///

4

1 回答 1

2

为了摆脱警告,只需在头文件中将您的类定义为 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];
于 2012-08-29T13:06:59.300 回答