UI控件笔记(十二):UI之TableEdit\ UISearchBar\自定义实时搜索\ 索引

来源:互联网 发布:闲鱼申请淘宝介入步骤 编辑:程序博客网 时间:2024/05/16 10:28

一、TableEdit的编辑和自定义TableEdit编辑(增加、减少、多选)

系统自带:AAAA 自定义:BBBB


#import "MainViewController.h"


@interface MainViewController ()<UITableViewDataSource,UITableViewDelegate>

{

    BOOL _isEdit;//判断是否显示多选框

}

@property(nonatomic,retain)NSMutableArray *dataArr;


@property(nonatomic,retain)NSMutableArray *selectArr;//记录我们选中的那些行的数组———AAAA


@property(nonatomic,retain)NSMutableArray *customSelectArr;//记录自定义多选删除内容的数组———BBBB

@property(nonatomic,retain)NSMutableArray *btnStatusArr;//记录每一行按钮的状态的数组———BBBB

@end


@implementation MainViewController


-(void)dealloc

{

    self.btnStatusArr =nil;

    self.customSelectArr =nil;

    self.selectArr =nil;

    self.dataArr =nil;

    [super dealloc];

}


-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

    self = [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if(self)

    {

        self.dataArr = [NSMutableArrayarrayWithCapacity:0];

        self.selectArr = [NSMutableArrayarrayWithCapacity:0];

        self.customSelectArr = [NSMutableArrayarrayWithCapacity:0];

        self.btnStatusArr = [NSMutableArrayarrayWithCapacity:0];

        

        _isEdit = NO;

    }

    

    return self;

}


- (void)viewDidLoad {

    [superviewDidLoad];

    

    self.automaticallyAdjustsScrollViewInsets =NO;

    

    [self loadData];

    

    [self makeUI];

    

    [selfmakeCustomBtn];

    // Do any additional setup after loading the view.

}


-(void)makeCustomBtn ———— BBBB

{

    NSArray *arr =@[@"增加",@"编辑",@"一键删除"];

    for(int i =0;i<3;i++)

    {

        UIButton *btn = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

        btn.frame = CGRectMake(i*110, 64, 110, 40);

        [btn setTitle:arr[i]forState:UIControlStateNormal];

        [btn addTarget:selfaction:@selector(customBtnDown:)forControlEvents:UIControlEventTouchUpInside];

        [self.viewaddSubview:btn];

        btn.tag = 1800+i;

    }

}


-(void)customBtnDown:(UIButton*)btn  ———— BBBB

{

    switch (btn.tag) {

        case 1800:

        {//增加

            //向数据源里添加数据

            [self.dataArraddObject:[NSStringstringWithFormat:@"%ld",self.dataArr.count]];//长度20,数据019,所以20就是下一个

            [self.btnStatusArraddObject:@"0"];

            break;

        }

        case 1801:

        {//编辑

            _isEdit = !_isEdit;

            for(int i =0;i<self.btnStatusArr.count;i++)

            {

                [self.btnStatusArrreplaceObjectAtIndex:i withObject:@"0"];//状态归零

            }

            [self.customSelectArrremoveAllObjects];//清空弃儿区

            break;

        }

        case 1802:

        {//一键删除

            //把多选的那些行从数据源里移除

            [self.dataArrremoveObjectsInArray:self.customSelectArr];//customSelectArr里的数组从dataArr里删除

            [self.btnStatusArrremoveObject:@"1"];

            break;

        }

        default:

            break;

    }

    

    //刷新table

    UITableView *table = (UITableView*)[self.viewviewWithTag:6000];

    [table reloadData];

}


-(void)loadData

{

    //做点假数据

    for(int i =0;i<20;i++)

    {

        [self.dataArraddObject:[NSStringstringWithFormat:@"%d",i]];

        

        [self.btnStatusArraddObject:@"0"];//0没选中,1选中了

    }

}


-(void)makeUI

{

    UITableView *table = [[UITableViewalloc] initWithFrame:CGRectMake(0,104, 320, self.view.frame.size.height-104)style:UITableViewStylePlain];

    table.dataSource = self;

    table.delegate = self;

    [self.viewaddSubview:table];

    [table release];

    table.tag = 6000;

    

    //做一个编辑按钮

    self.navigationItem.rightBarButtonItem =self.editButtonItem;

}


//编辑按钮会触发的方法就是来制作一个每次改变的bool

-(void)setEditing:(BOOL)editing animated:(BOOL)animated   ———— AAAA

{

    [supersetEditing:editinganimated:animated];//如果实现了当前的setEditing方法,需要用super先执行setEditing来改变editing这个bool

    NSLog(@"%d",editing);

    

    //找到table,根据editing的值让table改变为编辑或者普通模式

    UITableView *table = (UITableView*)[self.viewviewWithTag:6000];

    //下面就是改变table的编辑或者普通状态,第一个参数是一个bool值,就是上面super每次改变了的bool值,一次为0一次为1

    [table setEditing:editing animated:animated];

    

    //在这里判断是YES还是NOyes的话(开始编辑)这里什么也不干,no(结束编辑)这里把数据源修改一下,删除那些被多选的行

    if(editing ==NO)//NO的状态,table结束编辑,修改数据源

    {

        [self.dataArrremoveObjectsInArray:self.selectArr];//selectArr里的东西,从dataArr里删除

        [table reloadData];

    }

    else//只有编辑状态的时候,selectArr里面存的东西才算数

    {//table开始编辑

        [self.selectArrremoveAllObjects];//把选中数组的数据清空(上一次选过的数据,和非编辑状态下选中的那一行的数据)

    }

}


#pragma mark table的代理方法们


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

    return self.dataArr.count;

}


-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

    NSInteger section = indexPath.section;

    NSInteger row = indexPath.row;


    static NSString *iden =@"iden";

    UITableViewCell *cell = [tableViewdequeueReusableCellWithIdentifier:iden];

    

    //3、判断cell是否存在

    if(cell ==nil)//判断是否取到了,nil就是没取到

    {

        //实例化一个cell

        cell = [[[UITableViewCellalloc] initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:iden] autorelease];

    }

    //如果没有自定义cell,只是在用cell自己的属性的时候,不要清空cell

    for(id tempin cell.contentView.subviews)

    {

        [temp removeFromSuperview];

    }

    //cell.textLabel.text = self.dataArr[row];

    

    UILabel *nameLabel = [[UILabelalloc] initWithFrame:CGRectMake(10,5, 100, 20)];

    nameLabel.text = self.dataArr[indexPath.row];

    [cell.contentView addSubview:nameLabel];

    [nameLabel release];

    

    UIButton *multiSelectBtn = [UIButtonbuttonWithType:UIButtonTypeCustom];

    multiSelectBtn.frame = CGRectMake(120, 5, 23, 23);

    [multiSelectBtn setImage:[UIImageimageNamed:@"answer_much_normal.png"]forState:UIControlStateNormal];

    [multiSelectBtn addTarget:selfaction:@selector(multiBtnDown:)forControlEvents:UIControlEventTouchUpInside];

    [cell.contentView addSubview:multiSelectBtn];

    multiSelectBtn.tag = indexPath.row+1000;

    if(_isEdit)

    {

        multiSelectBtn.hidden = NO;

    }

    else

    {

        multiSelectBtn.hidden = YES;

    }

    

    UIButton *singleDeleteBtn = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

    singleDeleteBtn.frame = CGRectMake(250, 5, 60, 23);

    [singleDeleteBtn setTitle:@"del"forState:UIControlStateNormal];

    [singleDeleteBtn addTarget:selfaction:@selector(btnDown:)forControlEvents:UIControlEventTouchUpInside];

    [cell.contentView addSubview:singleDeleteBtn];

    singleDeleteBtn.tag = indexPath.row +1900;

    

    return cell;

}


//多选按钮事件

-(void)multiBtnDown:(UIButton*)btn ———— BBBB

{

    //btnStatusArr里存的是01

    if([self.btnStatusArr[btn.tag-1000] isEqualToString:@"0"])//判断是0还是1

    {//0进来没选中,要变成选中,要添加到customSelectArr中,改成1

        [btn setImage:[UIImageimageNamed:@"answer_much_select.png"]forState:UIControlStateNormal];//改变按钮的图片为选中图片

        [self.customSelectArraddObject:self.dataArr[btn.tag-1000]];//把这一行的数据存进准备多选删除的数组

        [self.btnStatusArrreplaceObjectAtIndex:btn.tag-1000withObject:@"1"];//把状态数组该行所在位改为1选中状态

    }

    else

    {//1进来,要变成没选中,要从customSelectArr中移除,改成0

        [btn setImage:[UIImageimageNamed:@"answer_much_normal.png"]forState:UIControlStateNormal];

        [self.customSelectArrremoveObject:self.dataArr[btn.tag-1000]];

        [self.btnStatusArrreplaceObjectAtIndex:btn.tag-1000withObject:@"0"];

    }

    //1、改变当前按钮的图片

    

    //2、改变status数组中的01

    

    //3、如果这行这次是选中添加到customSelectArr中,如果这行这次是非选中,从customSelectArr中移除

}


//单选删除按钮事件

-(void)btnDown:(UIButton*)btn   ———— BBBB

{

    //找到行

    int row = btn.tag -1900;

    //从数据源里把这行对应的数据删了

    [self.dataArrremoveObjectAtIndex:row];

    //刷新table

    UITableView *table = (UITableView*)[self.viewviewWithTag:6000];

    

    [table reloadData];

}


//设置table的编辑类型

-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath   ———— AAAA

{

    returnUITableViewCellEditingStyleDelete | UITableViewCellEditingStyleInsert;

}


//一会儿将从数据源中,把selectArr里的数据清除掉

//选中

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath  ———— AAAA

{

    //selectArr添数据

    //找到被选中这行的数据

    NSString *str = self.dataArr[indexPath.row];

    

    //把数据存入selectArr

    [self.selectArraddObject:str];

    NSLog(@"%@",self.selectArr);

}

//反选

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath ———— AAAA

{

    //selectArr删数据

    //找到被反选这行的数据

    NSString *str = self.dataArr[indexPath.row];

    

    //selectArr中把str删除

    if([self.selectArrcontainsObject:str])//判断数组中是否有一个数据对象,返回值是yes或者no

    {

        [self.selectArrremoveObject:str];

    }

    NSLog(@"%@",self.selectArr);

}




二、UISearchBarUISearchDisplayController(实时搜索)


#import "MainViewController.h"


@interface MainViewController ()<UITableViewDataSource,UITableViewDelegate,UISearchBarDelegate>

{

    UISearchDisplayController *_display;//搜索结果的display成员变量,这里做成全局变量主要是考虑内存释放时机

}

@property(nonatomic,retain)NSMutableArray *dataArr;

@property(nonatomic,retain)NSMutableArray *resultArr;//用来保存搜索结果数据的数组


@end


@implementation MainViewController


-(void)dealloc

{

    [_display release];

    self.resultArr =nil;

    self.dataArr =nil;

    [super dealloc];

}


-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

    self = [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if(self)

    {

        self.dataArr = [NSMutableArrayarrayWithCapacity:0];

        self.resultArr = [NSMutableArrayarrayWithCapacity:0];

    }

    return self;

}


- (void)viewDidLoad {

    [superviewDidLoad];  

    self.automaticallyAdjustsScrollViewInsets =NO;

    [self loadData]; 

    [self makeUI];

}


-(void)loadData

{

    NSArray *arr =@[@"白宇",@"徐鹏",@"孙冠宇",@"王勇",@"刘佳坤",@"芦艺",@"陈雷",@"朱丽丽",@"乔柏智",@"武鑫",@"李鹏飞",@"李煜",@"马强",@"韦庆江",@"那子玉",@"司文",@"吴鑫",@"邬林",@"韩淑惠",@"黄世伟",@"彭佳伟",@"王兴隆",@"吴雪松",@"王硕",@"杨林杰",@"李多军",@"赵明亮",@"邵运普",@"吴伟",@"郭峰泉",@"杨桁",@"于海尧",@"董强飞",@"王洋",@"高兵",@"范森军",@"杨胜超",@"赵丹",@"刘婉玲",@"王林",@"彭文杰",@"殷宪鹏",@"陈万柱",@"张显忠",@"蔡宇航",@"吕夏",@"马凡",@"王蕾",@"冯杨",@"王志超",@"刘文正",@"郑连杰",@"刘海洋",@"刘丹",@"张磊",@"宋昆达",@"陈伯怀",@"潘俊峰",@"何嘉伟",@"王行远",@"韩德顺",@"高明辉",@"赵华峰",@"赵俊隆",@"李传良",@"钱兆",@"聂康",@"罗红彪",@"刘伟",@"赵洪斌",@"王建军",@"寇明豪",@"姚成",@"张振兴",@"姜娜",@"郭德海",@"陈宇峰",@"韩卫星",@"曹猛",@"孙洪瑞",@"李孟东"];

    

    for(int i =0;i<arr.count;i++)

    {

        [self.dataArraddObject:arr[i]];

    }

}


-(void)makeUI

{

    //搜索框

    UISearchBar *searchBar = [[UISearchBaralloc] initWithFrame:CGRectMake(10,0, 300, 30)];//此处的searchbar也应该做成全局变量

    //searchBar.delegate = self;

    searchBar.tag = 13000;

    

    //table

    UITableView *table = [[UITableViewalloc] initWithFrame:CGRectMake(0,64, 320, self.view.frame.size.height-64)style:UITableViewStylePlain];

    table.dataSource = self;

    table.delegate = self;

    [self.viewaddSubview:table];

    [table release];

    table.tag = 6666;

    table.tableHeaderView = searchBar;//一般都把搜索框放到一个table的头上

    

    //display(展示搜索出来的东西用的table,也是个table)

    _display = [[UISearchDisplayControlleralloc] initWithSearchBar:searchBarcontentsController:self];//第一个参数是哪儿搜我有反应,第二个参数是我显示在哪个VC

    _display.searchResultsDataSource =self;

    _display.searchResultsDelegate =self;

}


#pragma markTable代理

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

    //因为display也是一个table那样的控件,所以他也会走table的代理方法

    //所以要在table的代理方法中判断,是我们的table还是displaytable

    

    if(tableView.tag ==6666)

    {

        return self.dataArr.count;

    }

    else

    {//display

        //根据查找结果制作一个查找结果的数组,然后把查找结果数组的长度返回

        //1、清空上次查找的结果

        [self.resultArrremoveAllObjects];

        //2、开始这次的查找

        for(NSString *strin self.dataArr)//遍历数据源

        {//把数据源里符合我们要求的内容存进结果数组

            UISearchBar *searchBar = (UISearchBar*)[self.viewviewWithTag:13000];

            NSRange range = [str rangeOfString:searchBar.text];//在数组源每一位的字符串中,查找是否有我们当前输入的内容

            if(range.location !=NSNotFound)

            {//找到了

                [self.resultArraddObject:str];//把数据源该位的内容存进结果数组

            }

        }

        //3、把这次查找的结果存进结果数组

        

        //4、把结果数组的长度返回

        returnself.resultArr.count;//返回搜索结果的table的长度

    }

}


-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

    static NSString *iden =@"pp";

    UITableViewCell *cell = [tableViewdequeueReusableCellWithIdentifier:iden];

    if(cell == nil)

    {

        cell = [[[UITableViewCellalloc] initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:iden] autorelease];

    }

    

    if(tableView.tag ==6666)

    {

        cell.textLabel.text =self.dataArr[indexPath.row];

    }

    else

    {//display

        cell.textLabel.text =self.resultArr[indexPath.row];

    }

    

    return cell;

}


三、自定义实时搜索


#import "MainViewController.h"


@interface MainViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>

{

    BOOL _isEdit;//判断是否在输入,也就是判断是否正在查找,用来设置table的数据源是dataArr还是resultArr

}

@property(nonatomic,retain)NSMutableArray *dataArr;

@property(nonatomic,retain)NSMutableArray *resultArr;


@end


@implementation MainViewController


-(void)dealloc

{

    self.resultArr =nil;

    self.dataArr =nil;

    [super dealloc];

}


-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

    self = [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if(self)

    {

        self.dataArr = [NSMutableArrayarrayWithCapacity:0];

        self.resultArr = [NSMutableArrayarrayWithCapacity:0];

        _isEdit =NO;//初始化为NO,没有开始搜索,用dataArr当数据源

    }

    

    return self;

}


- (void)viewDidLoad {

    [superviewDidLoad];  

    self.automaticallyAdjustsScrollViewInsets =NO;  

    [self loadData];  

    [self makeUI];

}


-(void)loadData

{

    for(int i =0;i<100;i++)

    {

        [self.dataArraddObject:[NSStringstringWithFormat:@"%d",i]];

    }

}


-(void)makeUI

{

    //1table

    UITableView *table = [[UITableViewalloc] initWithFrame:CGRectMake(0,104, 320, self.view.frame.size.height-104)style:UITableViewStylePlain];

    table.dataSource = self;

    table.delegate = self;

    [self.viewaddSubview:table];

    [table release];

    table.tag = 6666;

    //2、搜索框

    UITextField *text = [[UITextFieldalloc] initWithFrame:CGRectMake(10,69, 300, 30)];

    text.borderStyle =UITextBorderStyleRoundedRect;

    text.delegate = self;

    [self.viewaddSubview:text];

    [text release];

    text.tag = 5555;

    

    [text addTarget:selfaction:@selector(textEditChange:)forControlEvents:UIControlEventEditingChanged];//当输入发生改变时调用对应方法

}


#pragma mark textField的代理

-(void)textFieldDidBeginEditing:(UITextField *)textField

{

    _isEdit =YES;//开始编辑,所以准备要用resultArr当数据源

    

    UIView *ff = (UIView*)[self.viewviewWithTag:4000];

    

    //所有UIView的子类都可以用这个动画,UIView动画

    [UIViewanimateWithDuration:2animations:^{

        //想写啥写啥

        textField.frame = CGRectMake(10, 69, 240, 30);

        

    }];

    

    //textField.frame = CGRectMake(10, 69, 240, 30);

}


-(BOOL)textFieldShouldReturn:(UITextField *)textField

{

    _isEdit =NO;//结束编辑,用dataArr当数据源

    

    //刷新table,让table改为用dataArr当数据源

    UITableView *table = (UITableView*)[self.viewviewWithTag:6666];

    [table reloadData];

    

    textField.text = @"";//清空搜索框

    [self.resultArrremoveAllObjects];//清空搜索结果数组

    

    [UIViewanimateWithDuration:2animations:^{

        textField.frame = CGRectMake(10, 69, 300, 30);

    }];

    

    [textField resignFirstResponder];

    return YES;

}


//随时关注textField的内容改变

-(void)textEditChange:(UITextField*)text

{//从数据源里查找有没有我们输入的textfield的内容,这个方法因为每多写一个字就调用一次,所以就是实时查找了

    //1、清空上次查找结果

    [self.resultArrremoveAllObjects];

    //2、查找

    for(NSString *strin self.dataArr)//遍历数据源查找

    {

        //text.text就是输入框里的文字

        if([str rangeOfString:text.text].location !=NSNotFound)

        {//找到了进

            [self.resultArraddObject:str];//把数据源中对应的数据存进结果数组

        }

    }

    //3、刷新table

    UITableView *table = (UITableView*)[self.viewviewWithTag:6666];

    [table reloadData];

}


#pragma mark table的代理


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

    if(_isEdit ==NO)//判断是否在查找中

        return self.dataArr.count;//原始table

    else

        return self.resultArr.count;//搜索table

}


-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

    static NSString *iden =@"pp";

    UITableViewCell *cell = [tableViewdequeueReusableCellWithIdentifier:iden];

    if(cell == nil)

    {

        cell = [[[UITableViewCellalloc] initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:iden] autorelease];

    }

    if(_isEdit ==NO)

        cell.textLabel.text =self.dataArr[indexPath.row];

    else

        cell.textLabel.text =self.resultArr[indexPath.row];

    

    return cell;

}




四、索引(就是屏幕右边一竖行的字母)


#import "MainViewController.h"


@interface MainViewController ()<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic,retain)NSMutableArray *dataArr;

@end


@implementation MainViewController


-(void)dealloc

{

    self.dataArr =nil;

    [super dealloc];

}


-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

    self = [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if(self)

    {

        self.dataArr = [NSMutableArrayarrayWithCapacity:0];

    }  

    return self;

}


- (void)viewDidLoad {

    [super viewDidLoad];   

    self.automaticallyAdjustsScrollViewInsets =NO;  

    [self loadData];  

    [self makeUI];

}


-(void)loadData

{

    //有段有行的data数据源,索引引导的就是段

    for(int i ='A';i<= 'Z';i++)

    {

        NSMutableArray *arr = [NSMutableArrayarrayWithCapacity:0];//这个数组给小循环用

        for(int j =0;j<9;j++)

        {

            [arr addObject:[NSStringstringWithFormat:@"%c%d",i,j]];

        }

        [self.dataArraddObject:arr];

    }

    NSLog(@"%@",self.dataArr);

}


-(void)makeUI

{

    UITableView *table = [[UITableViewalloc] initWithFrame:CGRectMake(0,64, 320, self.view.frame.size.height-64)style:UITableViewStylePlain];

    table.dataSource = self;

    table.delegate = self;

    [self.viewaddSubview:table];

    [table release];

}


#pragma mark table代理

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{//

    return [self.dataArr[section]count];

}


-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{//

    static NSString *iden =@"pp";

    UITableViewCell *cell = [tableViewdequeueReusableCellWithIdentifier:iden];

    if(cell == nil)

    {

        cell = [[[UITableViewCellalloc] initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:iden] autorelease];

    }

    cell.textLabel.text =self.dataArr[indexPath.section][indexPath.row];

    return cell;

}


-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{//

    return self.dataArr.count;

}


-(NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

{

    return [NSStringstringWithFormat:@"%C",section+'A'];

}


//设置table的索引,索引内容应该和段头一样

-(NSArray*)sectionIndexTitlesForTableView:(UITableView *)tableView

{

    NSMutableArray *arr = [NSMutableArrayarrayWithCapacity:0];

    for(int i ='A';i<='Z';i++)

    {

        [arr addObject:[NSStringstringWithFormat:@"%c",i]];

    }

    return arr;

}


-(NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index

{

    NSLog(@"%@",title);

    NSLog(@"%ld",(long)index);

    return index;

}


0 0