簡體   English   中英

幾秒鍾后 SVProgressHud 消失

[英]SVProgressHud disappear after few seconds

我在我的應用程序中添加了 SVProgressHud,並且在大多數 viewController 中工作得非常好。 但是當我展示 SVProgressHud 時,它在導航控制器的第一個孩子中的行為很奇怪,它會顯示,但幾秒鍾后它會消失,只顯示活動指示器。
看到這個圖像,當我顯示progressHud時顯示

在此處輸入圖片說明

這將在幾秒鍾后顯示

在此處輸入圖片說明

我在 viewDidLoad 方法中展示了這個進度,這里是我的代碼。

- (void)viewDidLoad
{
    [super viewDidLoad];

    [SVProgressHUD show];
    [SVProgressHUD showWithStatus:nil maskType:SVProgressHUDMaskTypeBlack];
    [self performSelector:@selector(CallLanSelectDataWS) withObject:@"" afterDelay:0.1];
}

並在過程完成后關閉 SVProgressHud。

在后台線程中執行任務?

[SVProgressHUD show];

//Execute your task in differentthread
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

    [self callLanSelectDataWS];

    // After this task is done switch back to main thread
    dispatch_async(dispatch_get_main_queue(), ^{

        [SVProgressHUD showSuccessWithStatus:@"YEAH!"];
    });
});

目前正在尋找相同案例的答案。

默認情況下,SVProgress 將在 5.0 秒后自動關閉,就我而言,我使用 hack 來禁用關閉

在斯威夫特:

SVProgressHUD.setMinimumDismissTimeInterval(.infinity * 5.0)

也許根據需要設置指定的最小/最大時間間隔,強制解除可能會有所幫助

您可以使用 ProgressHUD 庫,而不是 SVPRogressHUD:

    ProgressHUD.show("put here text you want to be below activity indicator", interaction: true) 

要么

    ProgressHUD.show("", interaction: true) 

如果您不想要下面的任何文字,請將其設為空。

當您想關閉它時,只需輸入:

    ProgressHUD.dismiss()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM