UIPickerViewの選択肢が長くて入らない場合
UIPickerView上のラベルの文字サイズを調整してピッカー内に入るようにする。
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int,
forComponent component: Int, reusing view: UIView?) -> UIView
{
let label = (view as? UILabel) ?? UILabel()
label.text = self.addresses[row]
label.textAlignment = .center
label.adjustsFontSizeToFitWidth = true
return label
}
view が取れない場合もあるので ?? UILabel()
を忘れないように