我试图在我的pickerView中实现类似UITableViewCell字幕的内容。这就是我实现标题的方式,但是我希望有另一个字符串数组,它将在下面但在下一行之前以较小的字体显示。
func pickerView(pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusingView view: UIView?) -> UIView {
var pickerLabel = view as! UILabel!
if view == nil {
pickerLabel = UILabel()
}
let titleData = List[row]
let myTitle = NSAttributedString(string: titleData, attributes: [NSFontAttributeName:UIFont(name: "Helvetica Neue", size: 17.0)!,NSForegroundColorAttributeName:UIColor.whiteColor()])
pickerLabel!.attributedText = myTitle
pickerLabel!.textAlignment = .Center
return pickerLabel
}
有什么建议吗?实例
提前谢谢。