OGeek|极客世界-中国程序员成长平台

标题: ios - 在 iOS 7 上压缩的 UITableView sectionIndexTitles [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 15:00
标题: ios - 在 iOS 7 上压缩的 UITableView sectionIndexTitles

UITableView 的部分索引在 iOS 7 上会压缩,即使有足够的空间(这发生在 iPad 上)。在 iOS 6 上一切正常:

iOS 7 section indexes vs iOS 6 section indexes

这只发生在横向时。

UITableView 位于容器 View 内,因为我有一个 UISearchBar,在 TableView 上方有一个 UISearchDisplayController,而不是它的标题,但固定在 UINavigationBar 下。

有谁知道如何避免 sectionIndexTitles 压缩?



Best Answer-推荐答案


在 iOS6 之前,您可以枚举 tableview 的 subview 并修改具有 className UITableViewIndex 的 View 。像这样:

for(UIView *aView in [tableView subviews]) 
   NSLog(@"View:%@",aView);
   if([[[aView class] description] isEqualToString"UITableViewIndex"]) 
       aView.font=[UIFont fontWithName"Helvetica-Bold" size:18.0];

在 iOS7 中,Apple 更改了 View 层次结构并引入了 UITableViewWrapperView 作为 UITableView 的直接 subview ,它有效地隐藏了所有实现细节。它没有 subview 。不再修修补补。 所以我想唯一剩下的就是把它归档为一个错误。

关于ios - 在 iOS 7 上压缩的 UITableView sectionIndexTitles,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19110538/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4