ios - 在 iOS 7 上压缩的 UITableView sectionIndexTitles

标签 ios ipad uitableview ios7

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

iOS 7 section indexes vs iOS 6 section indexes

这只发生在风景中。

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

有人知道如何避免 sectionIndexTitles 压缩吗?

最佳答案

在 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/

相关文章:

ios - 在 UITableViewCell 中复制 UITextField

javascript - Android 上的 Quasar 错误:无法加载位于 ip:port 的网页,因为 net::ERR_ADDRESS_UNREACHABLE

ios - 在 UICollectionView 选择上选择 UITableView

ios - 在应用程序启动时在 iOS 模拟器中获取用户坐标

iphone - 在应用程序中查看核心数据

swift - 从自定义原型(prototype)单元格中的 UIButton PrepareForSegue

ios - *** 由于未捕获的异常 'NSGenericException' 而终止应用程序,原因 : 'Start date cannot be later in time than end date!'

iphone - 如何将不透明的 UIView 作为半透明 UIView 的 subview ?

iphone - 如何获取一个月内的所有星期日

ios - 使用自动布局时如何从代码更改 UITableView 的高度?