UIPickerView with custom views broken in iOS7

大兔子大兔子 提交于 2019-12-03 12:42:00
imihaly

It seems that for a strange reason, if the width of any column is higher than 1/3 of the picker view's width the layout breaks. So if you have a 320 pixel wide picker view 106 or less is working, but 107 or higher is wrong, regardless if you have 2,3,4 ... components. Really strange.

As imihaly said in his earlier post it looks like this only happens if the widthForComponent value for the LAST component is more than 106 pixels. The other components can return a value over 106 and it will look fine. Also, if you return a view that's smaller in width than the value returned by widthForComponent it will center the view, but it will be offset to the left by about 10 pixels.

Jon

I had a similar issue, but I was displaying simple numbers instead. See my similar question. Short answer is that I had to break up the components into different UIPickerViews.

As @imihaly mentioned, There is only one solutions that I come up with to increase a width of picker view which is add into view.

I have created a demo like https://github.com/Dharmesh-shah2412/demoPickerView

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!