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.这里只记录一些日记(只为提升英语,暂时有点忙,等转行了开始写)
  • 相关阅读:
    Asp.Net MVC ajax调用 .net 类库问题
    sql关键查询
    js数组
    win2003 sp2+iis 6.0上部署.net 2.0和.net 4.0网站的方法
    Linux开启服务器问题(李蕾问题)
    SWFUpload 中文乱码问题
    设置html滚动条(陶庭飞问题)
    反射(前台到后台,后台到前台)
    MySql数据类型
    将页面居中
  • 原文地址:https://www.cnblogs.com/liyang31tg/p/3655384.html
Copyright © 2011-2022 走看看