Question

I am subclassing UITextField to be able to set UIPickerView as an inputView. When my text field becomes first responder, UIPickerView shows up in place of keyboard.

The problem is, in some cases (especially when I set custom component widths), presented picker shows strange display artefacts. See attached picture.

What causes this strange display bug?
enter image description here

Was it helpful?

Solution

Turned out to be pretty simple. It looks like iPhone hates when you set UIPickerView frame by yourself. One must leave it to the framework by initializing it with CGRectZero frame.

UIPickerView *pv;
//pv = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, 300, 162)];
pv = [[UIPickerView alloc] initWithFrame:CGRectZero];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top