ios - SCLAertView 正在等待 API,但没有持续时间

标签 ios objective-c

我想使用 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/

相关文章:

ios - 无法将顶部约束添加到 View

ios - 绑定(bind)模型和 View : how to observe object properties

ios - Objective-C - 从核心数据中检索一对多关系数据

ios - 动态删除元素时如何使用自动布局?

iphone - Xcode 4.5 的 Storyboard

ios - 使用 pod 时,isKindOfClass 在目标之间不匹配

iphone - 如何在 [UIImage initWithData :] 中获取错误/警告

iphone - Xcode iPhone 在地址簿 View 中添加 "Directions to here"按钮

ios - 使用performSegueWithIdentifier从TableViewCell导航到另一个 View

objective-c - 从 objc 委托(delegate)给 swift 以解除模态视图