Недавно я добавил некоторый быстрый код в проект Objective-C, и я столкнулся с чем-то странным, с чем не могу разобраться.
Я использую панель поиска (из учебника Ray), которую я настроил. В методе cellForRowAtIndexPath
я могу настроить метки своих ячеек, и все работает нормально. Единственное, я не могу скрыть некоторые изображения в соответствии с условиями if (BOOL). Что-то должно быть не так с моим быстрым кодом, так как я могу скрыть эти изображения в файлах Objective-C с теми же условиями if (BOOL).
На всякий случай я публикую свой код, если кто-нибудь может мне помочь.
В SearchVC (быстро)
class aCell : UITableViewCell {
@IBOutlet weak var some label...
@IBOutlet weak var imageFacturation: UIImageView!
@IBOutlet weak var imageMail: UIImageView!
}
class PatientSearchViewController : ...
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCellWithIdentifier("CellSwift") as aCell // aCell is a class defined inside the file where I attach the label and imageView properties
var person : ClassObject
if tableView == self.searchDisplayController!.searchResultsTableView {
person = filteredObjects[indexPath.row]
} else {
person = objects[indexPath.row]
}
// Configure the cell
cell.labelLastname.text = person.lastname
cell.labelFirstname.text = person.firstname
if person.hasMailSent == false {
cell.imageMail.hidden == true // --> does not work in swift code but is Hidden in objective-C with the setHidden:true
}
if person.hasFacturation == false {
cell.imageFacturation.hidden == true // --> does not work in swift code but is Hidden in objective-C with the setHidden:true
}
return cell
}
У кого-нибудь есть идея?