我想使用 SCLAlertView 等待屏幕,直到 API 调用完成。 例如...
SCLAlertView *alert = [[SCLAlertView alloc]init];
[alert showWaiting];
[someAPIRequest makeAsynchronousCall:success^(MyClass *userData,NSError *error){
[alert hideWaiting];
}];
但是 SCLAlertView 在特定时间间隔后会自动隐藏,但我想通过调用方法来隐藏。
最佳答案
首先,您需要创建 SCLAppearance
并覆盖您想要设置的值。
以下是 Swift 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()
}
我想在Objective C中创建它应该没有问题。但是,我仅在 Swift 项目中使用 SCLAlertView。
关于ios - SCLAertView 正在等待 API,但没有持续时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41042632/