我是iOS Programming
的新手,我遇到了这个问题。假设我有以下两个功能:
class BaseViewController: UIViewController, ErrorMessageDelegate {
var uiView = UIView();
var viewErrorMessage:ErrorMessage!
func refresh(_sender: AnyObject) {
print("testing")
}
func getErrorMessage(message:String) {
super.viewDidLoad()
Dialog.dismiss()
ErrorMessage.message = message
viewErrorMessage = Bundle.main.loadNibNamed("ErrorMessage", owner: self, options: nil)?.first as! ErrorMessage
viewErrorMessage.delegate = self
self.view.addSubview(viewErrorMessage)
func removeSubView() {
viewErrorMessage.removeFromSuperview()
}
}
}
我想在函数刷新中调用函数 removeSubView 。我必须这样做,因为我需要将 refresh 函数覆盖到我的子类中。而且我需要将函数 removeSubView 放在 getErrorMessage 中,因为我应该这样做。有谁知道这是怎么做到的吗?
答案 0 :(得分:4)
请参考以下代码。它将帮助您解决问题。
代码:
class CustomQueryBuilder extends QueryBuilder {
// Override delete method
delete() {
return super.select('*').eager('reference').runAfter(async (olds, builder) => {
return await Promise.all(olds.map(old => old.$query(builder.context().transaction).mergeContext(builder.context()).nativeDelete()))
})
}
nativeDelete() {
return super.delete()
}
}
答案 1 :(得分:2)
是的,有可能
for (int second = 0; second < 60; second++) {
try {}
catch (WebDriverException we)
{}
if (second >= 60) {
//write failure
}
答案 2 :(得分:1)
不,这不可能-但我想知道为什么你会这么做?