我正在尝试显示如下页面
页面标题(左对齐)
区域名称(中心对齐)
该地区的人(详细标签中带有电子邮件的副标题)
但是,如果我选择副标题作为单元格样式,则所有内容都将左对齐,并且我无法在代码中更改它们。然后,如果我选择自定义作为样式,则详细文本标签将不会显示。
if(poDetailList.LastName == "POName"){
cell.backgroundColor = SharedClass().coopGroupHeaderColor
let selectedColor = UIView()
selectedColor.backgroundColor = SharedClass().coopGroupHeaderColor
cell.selectedBackgroundView = selectedColor
cell.textLabel?.textColor = UIColor.blackColor()
cell.textLabel?.font = UIFont.boldSystemFontOfSize(15.0)
cell.textLabel?.textAlignment = .Center
cell.accessoryType = .None
var t_header = ""
if(POShort != "OTHER" && POShort != "all" && POShort != "invalid"){
t_header = POName
}
else{
t_header = POName
}
cell.textLabel?.text = t_header
cell.detailTextLabel?.text = ""
cell.userInteractionEnabled = false;
} else{
cell.backgroundColor = indexPath.row % 2 == 0 ? UIColor.clearColor() : SharedClass().cellBackGroundColor
let selectedColor = UIView()
selectedColor.backgroundColor = SharedClass().selectedCellColor
cell.selectedBackgroundView = selectedColor
cell.textLabel?.font = UIFont.boldSystemFontOfSize(15.0)
cell.textLabel?.textAlignment = .Left
cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
var t_header = poDetailList.FirstName
cell.textLabel?.text = "Name:" + poDetailList.FirstName + " " + poDetailList.LastName
cell.detailTextLabel?.text = "Not Responded In Days:" + poDetailList.DaysNotResponded
cell.userInteractionEnabled = true;
}
谁能帮我这个?
非常感谢
设置两个标签的对齐方式
cell.textLabel?.textAlignment = .Left
cell.detailTextLabel?.textAlignment = .Right
我希望它能起作用!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)