-2

Regarding to the following image:

enter image description here

How do I increase the font size?

This is the code of BackTableVC.swift:

import Foundation

class BackTableVC: UITableViewController {

    var tableArray = [String]()

    override func viewDidLoad() {
        tableArray = ["event log", "my details", "research", "share", "checklists", "templates", "helpful links", "feedback"]
    }

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return tableArray.count;
    }

    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: tableArray[indexPath.row], for: indexPath) as UITableViewCell
        cell.textLabel?.text = tableArray[indexPath.row]
        cell.textLabel?.textColor = UIColor.white

        return cell
    }

How do I increase the font size? Any ideas?

Ahmad F
  • 30,560
  • 17
  • 97
  • 143
  • http://stackoverflow.com/questions/7957215/how-can-i-change-the-font-size-of-my-uitableview-cell-title – Ganesh Kumar Apr 17 '17 at 07:24
  • You can directly use this cell.textLabel.font = UIFont(name: "Avenir-Book", size: 15.0) – Aditya Apr 17 '17 at 07:28
  • Add `cell.textLabel?.font = [UIFont systemFontOfSize: 16.0];` to your `tableView` function. You can change 16.0 to any other font size you like. – SimpleBeat Apr 17 '17 at 07:28

2 Answers2

0
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: tableArray[indexPath.row], for: indexPath) as UITableViewCell
    cell.textLabel?.font = UIFont.systemFont(ofSize: 20)
    cell.textLabel?.text = tableArray[indexPath.row]
    cell.textLabel?.textColor = UIColor.white

    return cell
}

In the example above you'll be changing the font size, but not the font family, if you want to change the family as well you can use this code.

UIFont(name: "Avenir-Book", size: 16)
J. Koush
  • 1,028
  • 1
  • 11
  • 17
0
import UIKit

class BackTableVC: UITableViewController{
    var tableArray = [String]()
    override func viewDidLoad() {
        tableArray = ["event log","my details","research","share","checklists","templates","helpful links","feedback"]
    }
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return tableArray.count;
    }
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: tableArray[indexPath.row], for: indexPath) as UITableViewCell
        cell.textLabel?.text = tableArray[indexPath.row]
        cell.textLabel?.textColor = UIColor.white
        cell.textLabel?.font = UIFont.systemFont(ofSize: 25)//set your font size replace the 25 with your font size

        return cell
    }
Nandkishor mewara
  • 2,552
  • 16
  • 29