我无法理解为什么我的方法调用不正确。 我正在尝试使用快速的SSSnackbar for ios。它具有以下签名的方法:
@implementation SSSnackbar
+ (instancetype)snackbarWithMessage:(NSString *)message
actionText:(NSString *)actionText
duration:(NSTimeInterval)duration
actionBlock:(void (^)(SSSnackbar *sender))actionBlock
dismissalBlock:(void (^)(SSSnackbar *sender))dismissalBlock {
我对这种方法的要求:
var bar = SSSnackbar.snackbarWithMessage("Success auth" as NSString,
actionText: "Ok" as NSString, duration : NSTimeInterval(5),
actionBlock: {(sender: SSSnackbar) -> () in
println("Snackbar action")
}, dismissalBlock:nil)
Documentations说解雇Block可以是零。
编译错误:Error:(48, 38) cannot invoke 'snackbarWithMessage' with an argument list of type '(NSString, actionText: NSString, duration: Double, actionBlock: (SSSnackbar) -> (), dismissalBlock: nil)'
我试过没有String
NSString
,nil
没有var bar = SSSnackbar(message:"Success auth", actionText: "Ok", duration : NSTimeInterval(5) ,
actionBlock: {snackbar in println("clicked")}, dismissalBlock:nil)
解雇
headerImage = COA
headerImage {
10 = IMAGE
10 {
params = class="logo"
file {
import = uploads/media/
import.data = levelmedia:-1, slide
import.listNum = 0
width.field = imagewidth
width.wrap = |m
height.field = imageheight
height.wrap = |m
treatIdAsReference = 1
}
}
}
答案 0 :(得分:0)
我解决了这个问题:
var bar = SSSnackbar(message:"Success auth", actionText: "Ok", duration : NSTimeInterval(5) ,
actionBlock: {snackbar in println("clicked")}, dismissalBlock:nil)
我不明白为什么我应该用构造函数调用它而不是将其称为静态类成员,但它似乎与此question中的相同。