4thSpace
4thSpace

Reputation: 44352

How to change cell label font size?

I'd like to change the font size on a table cell label. The font face should stay whatever it is. I'm using

System - System

since that is what shows in the Xcode interface.

I'm doing the following in

tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

but nothing is happening. Any suggestions how this should be done?

cell.labelName.font = UIFont(name: "System - System", size: CGFloat(16))

Upvotes: 1

Views: 3526

Answers (1)

Bilal
Bilal

Reputation: 19156

You can set the system font like this.

cell.labelName.font = UIFont.systemFont(ofSize: 16)

UIFont(name:size:) returns nil if font is not available and thats why nothing happening. I don't think "System - System" is a valid font name.

Upvotes: 5

Related Questions