我们如何指定显示 SectionIndexes 的框架的宽度。我正在显示下面的图片将解释我的情况。
我想在 sectionIndex 中包装单词,当 SectionIndex 框架大小固定时,这是可能的,所以我想设置 SectionIndex 框架的宽度,如右侧显示的那样。SectionIndex 框架会自动调整大小到其中的单词长度。
我编写了代码以从 SectionIndexTitle 返回数组,如下所示:
NSMutableArray *array = [[NSMutableArray alloc] init];
for (int i = 0; i <[keys count]; i++) {
NSString *str = [self.keys objectAtIndex:i];
int length = [str length];
if (length > 9) {
str = [NSString stringWithFormat:@"%@..",[str substringToIndex:8]];
}
[array addObject:str];
}
NSArray *a =[NSArray arrayWithArray:array];
[array release];
return a;
你能帮我解决这个问题吗...!
最佳答案
遗憾的是,无法使用公共(public) API 自定义部分索引。
如果此功能对您的应用如此重要,您可能最终会创建自定义部分索引 View 。
关于iphone - 设置UITableView右侧显示的SectionIndex的宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10085604/