Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在tableView中更改文本大小_Ios_Uitableview - Fatal编程技术网

Ios 如何在tableView中更改文本大小

Ios 如何在tableView中更改文本大小,ios,uitableview,Ios,Uitableview,有谁能告诉我如何更改tableView中的文本大小,使下面屏幕截图中的文本适合屏幕宽度: 当前tableView代码为: func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath

有谁能告诉我如何更改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
}

提前谢谢

设置自动收缩最小缩放比例。如果您的文本足够长,超出了实际的标签框架,那么您的字体将缩小到您在序列图像板或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更改为其他选项