Subtitle (2nd row) for UIPickerView and viewForRow in Swift

Viewed 282

I'm trying to implement something like the subtitle of a UITableViewCell look like in my pickerView. This is how I implement the title, but I would like to have another string array that will be shown in smaller font just underneath but before the next row.

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
}

Any advice? Examples?

Thank you in advance.

0 Answers
Related