当我们阅读一篇文章,肯定过一段时间会忘记,那时候我们就需要用到搜索这个功能,搜索我们当时阅读的文字,用到搜索最多的恐怕是我用到的通讯录,

自从出了微信,一直在想,微信的那个右边顶部的搜索按钮是怎么加的,一直在想,最多想多的要么是一张图片,只能是张图片,如果是图片,那个只能自定义右侧,所以这个方法肯定是可以,还有一种情况,就是自带的方法有这个图片。

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
    return  @[@"{search}"];
    //等价于[arr addObject:UITableViewIndexSearch];
}

//api给出这样的解释

UIKIT_EXTERN NSString *const UITableViewIndexSearch NS_AVAILABLE_IOS(3_0) __TVOS_PROHIBITED;

Including this constant string in the array of strings returned by sectionIndexTitlesForTableView: will cause a magnifying glass icon to be displayed at that location in the index.

// This should generally only be used as the first title in the index.