Ho un UIPickerView come posso renderlo multilinea? Ho un lungo testo.Come posso rendere UIPickerView Multiline in rapido?
Ecco il mio codice.
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
var returnResult: String = ""
if pickerView.tag == 1 {
//This picker has long text
let position: UInt = UInt(row)
returnResult = list.objectAtIndex(position).Description.Value;
} else if pickerView.tag == 2 {
returnResult = questionTwoOptions[row]
} else if pickerView.tag == 3 {
returnResult = questionThreeOptions[row]
} else {
returnResult = ""
}
print(returnResult)
return returnResult
}
Ecco il mio viewForRow Methode
func pickerView(pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusingView view: UIView?) -> UIView {
let label = UILabel(frame: CGRectMake(0, 0, 400, 44));
label.lineBreakMode = .ByWordWrapping;
label.numberOfLines = 0;
//view!.addSubview(label)
return label;
}
Implementare il viewForRow' delegato ' metodo e restituire un 'UILabel' secondo necessità. – rmaddy