开发者

UITableView Section Index not working as expected

When I add a section index consisting of "A", "B", ..., "Z" to my UITableView, everything works fine in the iPhone simulator. In this case, I get A, B, C,..., Z displayed in a horizontal line on the right hand side of my UITableview. 开发者_如何学Go If I add a 27th element (e.g. "Other") to the section index titles, the section index will now show A,* ,C ,* ,E,* ,H ,* ,J ,* ,L ,* ,N ,* ,P ,* ,R ,* ,U ,* ,W ,* ,Y ,Other ,* ,Other. Here * represents a circle that is rendered.

Any ideas as to why A,B,C,...,Z,Other is not displayed as I would expect?

Is there a maximum number of entries you can have in a section index?

If I've exceeded the maximum number of entries in the section index and the list gets compressed, why does "Other" show up twice in the compressed section index?

I get the following behavior when I press entries in the section index:

Press 1st Other: Title = Y, Index = 24 returned

Press last * : Title = Z, Index = 25 returned

Press 2nd other : Title = Other, Index = 26 returned


Is there a maximum number of entries you can have in a section index?

Correct. Once you move beyond a certain number of entries in the index, the OS will automatically start condensing the list (and replacing with circles) so that you can see as much of the list as possible without requiring the user to scroll. The first time I saw this I was surprised, but it does make sense ... otherwise, the OS would need to resize the elements in the index, or force the end of the index off-screen, neither of which are usable solutions.

Hope this helps. Andrew

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜