我的tableView设置
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath == kFirstCellIndexPath && category == .overtime {
return CGFloat.leastNormalMagnitude // it will crash
return 0 // it will not crash
} else {
return UITableViewAutomaticDimension
}
}
然后我设置单元格的高度
<template>
<multiselect v-model="value"
:options="options"
:multiple="true"
:close-on-select="false"
:clear-on-select="false"
:hide-selected="true"
placeholder="Pick some"
label="name"
track-by="name">
</multiselect>
</template>
<script>
import Multiselect from 'vue-multiselect'
export default {
components: {
Multiselect
},
data () {
return {
value: [
{ name: 'Vue.js', language: 'JavaScript' }
],
options: [
{ name: 'Vue.js', language: 'JavaScript' },
{ name: 'Adonis', language: 'JavaScript' },
{ name: 'Rails', language: 'Ruby' },
{ name: 'Sinatra', language: 'Ruby' },
{ name: 'Laravel', language: 'PHP' },
{ name: 'Phoenix', language: 'Elixir' }
]
}
}
}
</script>
当我重新加载tableView时,它崩溃了,为什么?
答案 0 :(得分:0)
替换此行
return CGFloat.leastNormalMagnitude
与
return CGFloat(FLT_MIN)
在表格视图的heightForRowAtIndexpath
方法中。