开发者

Picker row defaulting to next-to-the-last

I have a standard picker (copied out of the docs) with 6 rows. The row count is correctly logged as 6. When I try to select the last row:

[delpicker selectRow:5 inComponent:0 animated:NO]; 

it selects the 4th row instead. But when I try to:

[delpicker selectRow:4 inComponent:0 animated:NO]; 

it selects the correct, 4th, row (0 indexed). As a matter of fact, it works fine for rows 0, 1, 2, 3, 4... just not for row 5. Of course, if I ask for row 6, it sets it to the first (0th) row.

Really, I want the picker start with showing the row that the user selected before, and I found tha开发者_运维技巧t that works fine for everything unless the user selected the last row. While trying to figure out why, I learned that even just specifying a specific row, as I did above, is not working. When the user selects the last row, the row is correctly noted to be the last row (row 5). The problem is simply in setting the selectRow.

Any ideas?


Ugh. The frame I'd specified for the picker was too big! What a silly reason for the picker to malfunction.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜