У меня есть TableView и я хочу, чтобы изменить шрифт четных строк, Вот мой код:Swift - TableView, изменение шрифта четных строк жирным
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "ProductListTableViewCell"
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! ProductListTableViewCell
let product = productList[indexPath.row]
cell.productName.text = product.name
cell.productPrice.text = "\(product.price) manat"
if(indexPath.row % 2 == 0) {
cell.productName.font = UIFont.boldSystemFontOfSize(13.0)
cell.productPrice.font = UIFont.boldSystemFontOfSize(13.0)
}
return cell
}
когда я запускаю мой код, в начале все работает правильно, когда я просматриваю свой вид таблицы, все новые строки, появившиеся на экране, становятся жирным, как четным, так и старым. Что я делаю не так?
благодарит за ответ, все работает. Я должен был установить нечетные строки тоже – kakajan