Swift xcode 6:滚动动态表超出范围时字体大小发生变化
当行滚动出视图时,使用动态表的ViewController中TextView的字体大小会发生变化。静态表不会发生这种情况。脚本中的字体大小设置正确 我必须在自定义类中显式更改字体大小吗 以下是一些代码(按照@neo的要求):Swift xcode 6:滚动动态表超出范围时字体大小发生变化,swift,uitableview,nspredicate,nsfetchrequest,uifont,Swift,Uitableview,Nspredicate,Nsfetchrequest,Uifont,当行滚动出视图时,使用动态表的ViewController中TextView的字体大小会发生变化。静态表不会发生这种情况。脚本中的字体大小设置正确 我必须在自定义类中显式更改字体大小吗 以下是一些代码(按照@neo的要求): 另一篇帖子指出,通过选择UITextView,问题得以解决。这对我有用 override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> C
另一篇帖子指出,通过选择UITextView,问题得以解决。这对我有用
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> CREWBasicSuppliesCell {
let cell = tableView.dequeueReusableCellWithIdentifier(cellName) as! CREWBasicSuppliesCell
// NSLog("section %d", indexPath.section)
if indexPath.section == 1 {
var row = 0
row = indexPath.row
var fetchRequest = NSFetchRequest(entityName: "Switch")
var predicate = NSPredicate(format: "(viewName = %@)",viewName)
fetchRequest.predicate = predicate
// Execute the fetch request
var error: NSError? = nil
if var fetchResults = managedObjectContext?.executeFetchRequest(fetchRequest, error: &error) as? [Switch] {
var recordCount = 0
recordCount = fetchResults.count
if recordCount > 0 {
var appConfig = fetchResults [row]
cell.mySwitch.on = appConfig.switchValue.boolValue
cell.myTextView.text = appConfig.switchDescription
}
}
} else { // section 0
cell.mySwitch.hidden = true
var fetchRequest = NSFetchRequest(entityName: "View")
var predicate = NSPredicate(format: "(viewName = %@)",viewName)
fetchRequest.predicate = predicate
// Execute the fetch request
var error: NSError? = nil
if var fetchResults = managedObjectContext?.executeFetchRequest(fetchRequest, error: &error) as? [View] {
var row = 0
row = indexPath.row
var recordCount = 0
recordCount = fetchResults.count
if recordCount > 0 {
var appConfigView = fetchResults [row]
cell.myTextView.text = appConfigView.viewDescription
}
}
}
// NSLog("section %d", indexPath.section)
return cell
}