任何人都可以告诉我如何更改tableView中的文本大小,以便下面屏幕截图中的文本适合屏幕的宽度:
当前的tableView代码是:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath)
cell.textLabel!.text = self.dataArray[indexPath.row]
cell.imageView!.image = UIImage(named: "20x20_empty-round-radiobutton-choice-ui")
return cell
}
提前致谢!
答案 0 :(得分:2)
请尝试以下代码:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath)
cell.textLabel!.text = self.dataArray[indexPath.row]
cell.textLabel.font = UIFont(name: cell.textLabel.font.fontName, size:15) // Change the font size as per your requirement
cell.imageView!.image = UIImage(named: "20x20_empty-round-radiobutton-choice-ui")
return cell
}
答案 1 :(得分:1)