【发布时间】:2015-12-23 05:51:03
【问题描述】:
现在,如果我得到任何值 nil,我会隐藏该标签
问题:
但是当我隐藏该标签时,它会显示空白
这是我的代码::
let dic = finalcarexpense.objectAtIndex(indexPath.row) as! NSDictionary
if lastcruisebool == true
{
cell.lblcruisecontroll.text = (dic["cruise_control"] as? String)!
}
else
{
cell.lblcruisecontroll.hidden = true
cell.placecruisecontrol.hidden = true
}
if lastremotebool == true
{
cell.lblremotecentrallocking.text = (dic["remote_central_locking"] as? String)!
}
else
{
cell.lblremotecentrallocking.hidden = true
cell.placeremotecentrallocking.hidden = true
}
if lastacbool == true
{
cell.lblairconditioning.text = (dic["air_conditioning"] as? String)!
}
else
{
cell.lblairconditioning.hidden = true
cell.placeac.hidden = true
}
if lastbluetoothbool == true
{
cell.lblbluetooth.text = (dic["bluetooth"] as? String)!
}
else
{
cell.lblbluetooth.hidden = true
cell.placebluetooth.hidden = true
}
if lastradiocdbool == true
{
cell.lblradiocd.text = (dic["radio_cd"] as? String)!
}
else
{
cell.lblradiocd.hidden = true
cell.placeradiocd.hidden = true
}
if lastpowerbool == true
{
cell.lblpowersteering.text = (dic["power_steering"] as? String)!
}
else
{
cell.lblpowersteering.hidden = true
}
那么有什么解决方案,比如我应该设置UILabel hieght 0 吗?还是我应该使用UITableViewCell来做到这一点??
【问题讨论】:
-
您应该过滤包含数据的数组,而不是将
Height设置为 0 -
但数组中没有数据@HamzaAnsari
-
它基于用户选择@HamzaAnsari
-
从tableview中删除依赖于数据的单元格。
-
从 uitableview 中删除单元格的代码是什么? @iOSGuru
标签: ios swift uitableview uilabel ios9