UItableVIew初探

UItableView


style
/*
 //普通
  UITableViewStylePlain,  
 //分组
  UITableViewStyleGrouped
*/

//表格视图
    UITableView * tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    //设置数据源
    tableView.dataSource = self;
    //设置代理
    tableView.delegate = self;
    //分区头的高度
    tableView.sectionHeaderHeight = 30;
    //分区尾的高度
    tableView.sectionFooterHeight = 30;

    //行高,默认行高是44。
//    tableView.rowHeight = 100;
//    tableView.backgroundColor = [UIColor grayColor];

/*
        
         UITableViewCellSeparatorStyleNone 没有线
         UITableViewCellSeparatorStyleSingleLine  单行线
         UITableViewCellSeparatorStyleSingleLineEtched  被石化的单行线
         
         */
        //线的风格
        _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
//        _tableView.separatorColor = [UIColor redColor];
        //线的内边距
        _tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);

//行高固定时使用
        _tableView.rowHeight = 60;

    
    //设置背景View
//    UIImageView * imageView = [[UIImageView alloc] initWithFrame:tableView.bounds];
//    imageView.image = [UIImage imageNamed:@"baby.jpg"];
//    tableView.backgroundView = imageView;

//索引区域的背景
        _tableView.sectionIndexBackgroundColor = [UIColor whiteColor];
        //设置索引文字的颜色
        _tableView.sectionIndexColor = [UIColor blueColor];
        //cell行数小于多少是展示索引
        _tableView.sectionIndexMinimumDisplayRowCount = 100;
        //选择索引时的背景颜色
        _tableView.sectionIndexTrackingBackgroundColor = [UIColor clearColor];

//设置编辑模式
    [self.tableView setEditing:YES animated:YES];
    
//得到所有选中的行数
    NSArray * deleteList = [self.tableView indexPathsForSelectedRows];


转载于:https://www.cnblogs.com/hlgbys/p/5311984.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值