我试图用一种模式初步化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是一个简单的应用程序,我设置显示完整的代码和问题(第二张图片) \\
///
答案 0 :(得分: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];