gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:20:12 24 4
gpt4 key购买 nike

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com