是否可以將圖片添加到我的搜索欄結果中?我可以使用以下內容添加文本:搜索欄結果在文本旁邊添加圖片
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(self.identifier) as! UITableViewCell
var text: String?
if tableView == self.searchResultsController?.tableView {
if let results = self.results {
text = self.results!.objectAtIndex(indexPath.row) as? String
}
} else {
// text = MyVariables.users[indexPath.row] as? String
}
cell.textLabel!.text = text
return cell
}
你必須添加圖像視圖到你的單元格。 –
@ T_77設置圖像視圖後,圖像如何知道進入文本的左側? – SlopTonio
你是否以編程方式設置圖像視圖? –