Ios 如何在tableView中更改文本大小
有谁能告诉我如何更改tableView中的文本大小,使下面屏幕截图中的文本适合屏幕宽度: 当前tableView代码为:Ios 如何在tableView中更改文本大小,ios,uitableview,Ios,Uitableview,有谁能告诉我如何更改tableView中的文本大小,使下面屏幕截图中的文本适合屏幕宽度: 当前tableView代码为: func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath
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
}
提前谢谢 设置自动收缩最小缩放比例。如果您的文本足够长,超出了实际的标签框架,那么您的字体将缩小到您在序列图像板或xib中提供的最小字体比例
请尝试以下代码:
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
}
转到情节提要中的textLabel属性,并将autoshrink更改为其他选项