本文介绍了设置显示在UITableView右侧的SectionIndex的宽度吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何指定在其中显示SectionIndex的框架的宽度.我在下面显示图片将解释我的状况.

How can we specify the width of the frame in which SectionIndexes are displaying. I m displaying an image below will explain the condition I have.



我想将文字包装在sectionIndex中,并且在SectionIndex框架大小固定的情况下有可能,所以我想设置如右侧显示的SectionIndex框架的宽度.SectionIndex框架会根据以下内容自动调整大小到其中的单词长度.



I want to wrap the words within the sectionIndex and it is possible when SectionIndex frame size is fixed so I want to set the width of the SectionIndex Frame as displayed on the right side.SectionIndex frame automatically resizes according to the word length within it.

我编写了如下代码来从SectionIndexTitle返回数组:

I wrote the code to return the array from SectionIndexTitle as given below:

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;

请您帮我解决这个问题!!

Would u please help me regarding this...!

推荐答案

不幸的是,无法使用公共API自定义节索引.

Unfortunately, customizing the section index is not possible using the public APIs.

如果此功能对您的应用如此重要,您可能最终会创建一个自定义节索引视图.

You'll probably end up creating a custom section index view if this feature so important for your app.

这篇关于设置显示在UITableView右侧的SectionIndex的宽度吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 13:27