美文网首页
UITableviewcell控件

UITableviewcell控件

作者: 0bf43b438419 | 来源:发表于2019-04-02 11:54 被阅读0次

    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

        UITableViewCell * cell =[tableView dequeueReusableCellWithIdentifier:@"cell"];

        if (!cell) {

            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];

        }

        if (indexPath.row == 0) {

            UILabel  * label = [[UILabel alloc] initWithFrame:CGRectMake(280, 30, 140, 30)];

            label.text = @"收到的评论";

            [cell addSubview:label];

            UIImageView  * img =[[UIImageView alloc] initWithFrame:CGRectMake(30, 20, 60, 60)];

            img.image=[UIImage imageNamed:@"DX"];

            [cell addSubview:img];

        }else if (indexPath.row == 1){

            UILabel  * label1 = [[UILabel alloc] initWithFrame:CGRectMake(280, 30, 140, 30)];

            label1.text = @"发出的评论";

            [cell addSubview:label1];

            UIImageView  * img1 =[[UIImageView alloc] initWithFrame:CGRectMake(30, 20, 60, 60)];

            img1.image=[UIImage imageNamed:@"FC"];

            [cell addSubview:img1];

        }else if (indexPath.row == 2){

            UILabel  * label2 = [[UILabel alloc] initWithFrame:CGRectMake(280, 30, 140, 30)];

            label2.text = @"收藏";

            [cell addSubview:label2];

            UIImageView  * img2 =[[UIImageView alloc] initWithFrame:CGRectMake(30, 20, 60, 60)];

            img2.image=[UIImage imageNamed:@"SC"];

            [cell addSubview:img2];

        }else if (indexPath.row == 3){

            UILabel  * label3 = [[UILabel alloc] initWithFrame:CGRectMake(280, 30, 60, 30)];

            label3.text = @"通知";

            [cell addSubview:label3];

            UIImageView  * img1 =[[UIImageView alloc] initWithFrame:CGRectMake(30, 20, 60, 60)];

            img1.image=[UIImage imageNamed:@"TZ"];

            [cell addSubview:img1];

        }

        else{

            UILabel  * label4 = [[UILabel alloc] initWithFrame:CGRectMake(280, 30, 140, 30)];

            label4.text = @"收藏";

            [cell addSubview:label4];

            UIImageView  * img1 =[[UIImageView alloc] initWithFrame:CGRectMake(30, 20, 60, 60)];

            img1.image=[UIImage imageNamed:@"SC"];

            [cell addSubview:img1];

        }   

    //    表格里后面的小箭头

        cell.accessoryType = 1;

        return cell;

    }


    相关文章

      网友评论

          本文标题:UITableviewcell控件

          本文链接:https://www.haomeiwen.com/subject/kaiwbqtx.html