SID*_*SID 4 width uipickerview swift ios8
我根本不知道如何在我的 UIPickerView 上获取组件的宽度。它不允许一些简单的(Int),因为它需要是 CGFloat。我到底在 <#code#> 部分放了什么?
func pickerView(pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat {
<#code#>
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
该方法不会“获取组件的宽度...”选择器视图调用该方法来询问您组件应该有多宽。
您的方法可能很简单:
func pickerView(pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat
{
return CGFloat(25.0)
}
Run Code Online (Sandbox Code Playgroud)
(或任何适合您的选择器视图的宽度...)
您只需要将结果转换为 expected 类型。
| 归档时间: |
|
| 查看次数: |
2104 次 |
| 最近记录: |