2016-12-08 48 views
2

我想使用SCLAlertView等待屏幕,直到API調用完成。 例如...SCLAertView等待API無持續時間

SCLAlertView *alert = [[SCLAlertView alloc]init]; 
[alert showWaiting]; 
[someAPIRequest makeAsynchronousCall:success^(MyClass *userData,NSError *error){ 
    [alert hideWaiting]; 

}]; 

但SCLAlertView自動隱藏特定的時間間隔後,但我想通過調用一個方法來隱藏。

回答

2

首先,您需要創建SCLAppearance並覆蓋您希望設置的值的值。

這裏是雨燕3.0一個例子:

// Create the appearance 
// Hide the close button and disable autoDismiss 
let appearance = SCLAlertView.SCLAppearance(showCloseButton: false, shouldAutoDismiss: false) 
// Initialise the alert using appearance 
let alert = SCLAlertView(appearance: appearance) 
// Present the alert 
alert.showWait("Title", subTitle: "Subtitle") 
// 
someBlock { 
    alert.hideView() 
} 

我猜目標C創造它應該是沒有問題的。不過,我只在Swift項目中使用SCLAlertView。

+0

謝謝你,先生...我做同樣的事情,它的工作.. –