我收到一个错误,因为“表达式类型不明确,没有更多上下文”
这是我的代码
@IBOutlet var customerDashboardButtons:[NSArray]?
var predicate = NSPredicate(format: "SELF.tag == %d", tag)
var filteredButtons = customerDashboardButtons!.filter { predicate.evaluateWithObject($0) };
if 0 < filteredButtons.count {
var button = customerDashboardButtons!.first
button.hidden = true // getting an error in this line as "Type of expression is ambiguous without more context
}
我尝试了以下方法,
var button:UIButton = customerDashboardButtons!.first //Error "NSArray? is not convertible to UIButton"
var button = customerDashboardButtons!.first as UIButton //Error "NSArray? is not convertible to UIButton"
对此的任何帮助表示赞赏。