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.这里只记录一些日记(只为提升英语,暂时有点忙,等转行了开始写)
  • 相关阅读:
    几种开源SIP协议栈对比OPAL,VOCAL,sipX,ReSIProcate,oSIP
    google开源的C++性能分析工具
    常用SNS开源系统比较
    推荐20个开源项目托管网站
    web2.0的几个开源项目
    开源src镜像
    Niagara解决设备连接应用的软件框架平台技术。
    Signing key has not been configured
    Mybatis 简单的CRUD 基于XML文件配置
    HDU4451Dressing(计数)
  • 原文地址:https://www.cnblogs.com/liyang31tg/p/3655384.html
Copyright © 2011-2022 走看看