ios开发 tableview小结

来源:互联网 发布:ecshop 查看sql语句 编辑:程序博客网 时间:2024/05/23 19:18

tableview简单教程这篇不错:http://www.cnblogs.com/top5/archive/2012/05/17/2506604.html


左边白色边距去掉:

 if ([DataTablerespondsToSelector:@selector(setSeparatorInset:)]) {

        [DataTablesetSeparatorInset:UIEdgeInsetsZero];

        

    }

    if ([DataTablerespondsToSelector:@selector(setLayoutMargins:)])  {

        [DataTablesetLayoutMargins:UIEdgeInsetsZero];

    }



-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPat{

    if ([cellrespondsToSelector:@selector(setLayoutMargins:)]) {

        [cell setLayoutMargins:UIEdgeInsetsZero];

    }

    if ([cellrespondsToSelector:@selector(setSeparatorInset:)]){

        [cell setSeparatorInset:UIEdgeInsetsZero];

    }

}


去掉多余空白行:

DataTable.tableFooterView = [[UIViewalloc]init];


禁止滑动:

DataTable.scrollEnabled=NO;


点击事件:

- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    if(indexPath.row==1){


    }

    if(indexPath.row==0){

     

    }


}





0 0
原创粉丝点击