zoukankan      html  css  js  c++  java
  • ios-表视图-问题

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
        static NSString * cellIdentifier=@"cell";//标示符,每个表格的cell都不一样,我们可以将一定相同的cell用一个表示符指定以下。这个是在预编译的时候就放到内存了的
        UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];//根据标示符在池子里面取cell
        if (cell==nil) {
            cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];//取不到就创建
        }
        cell.backgroundColor=nil;
        NSString *fontname=_fontarray[indexPath.section][indexPath.row];
        cell.textLabel.text=fontname;
        cell.textLabel.font=[UIFont fontWithName:fontname size:14];

    cell.selectionStyle=UITableViewCellSelectionStyleDefault;//设置选中状态,默认选中状态背景是蓝色的
        //设置背景视图
        UIImageView *cellbackgroundview=[[UIImageView alloc]initWithFrame:CGRectZero];
        cellbackgroundview.backgroundColor=[UIColor brownColor];
        cell.backgroundView=cellbackgroundview;
        
        //设置选中背景
        UIImageView* selectcellbackgroundview=[[UIImageView alloc]initWithFrame:CGRectZero];
        selectcellbackgroundview.backgroundColor=[UIColor purpleColor];
        cell.selectedBackgroundView=selectcellbackgroundview;
    
    
    
    return cell;
    }
    1.这里只记录一些学习笔记 2.这里只记录一些学习心得,如果心得方向有错,请留言 2.这里只记录一些日记(只为提升英语,暂时有点忙,等转行了开始写)
  • 相关阅读:
    C# 并行线程调用
    Oracle定时备份
    读取Excel里面的内容转为DataTable
    c# 将json数据转为键值对
    Py基础+中级
    深入理解DIP、IoC、DI以及IoC容器(转载)
    错误页面的配置
    JavaScript重载
    关于为空必填js判断
    MyEclipse CI 2018.8.0正式发布(附下载)
  • 原文地址:https://www.cnblogs.com/liyang31tg/p/3655384.html
Copyright © 2011-2022 走看看