我有一个包含多行文本的 UITableviewCell。我想弄清楚如何使每行具有不同的字体大小。
这是我用来填充表格单元格的代码:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell:UITableViewCell = tableView.dequeueReusableCellWithIdentifier("eventCell")!
cell.textLabel!.textAlignment = NSTextAlignment.Center
cell.textLabel!.numberOfLines = 0
cell.textLabel!.lineBreakMode = NSLineBreakMode.ByWordWrapping
cell.textLabel!.text = self.eventsToday[indexPath.row].eventTitle + "\n" + self.eventsToday[indexPath.row].eventPlaceName
return cell
}
有没有一种方法可以减小“\n”换行符后的字体大小,使标有“eventPlaceName”的字符串显示为小于标有“eventTitle”的字符串?
最佳答案
关于swift - 单个 UITableview 单元格中的多种字体大小(Swift),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34448378/