zoukankan      html  css  js  c++  java
  • UITableView 点击展开的实现

    推介看下这里的 内容  http://www.cnblogs.com/kenshincui/p/3931948.html

    IOS8 above

    UITabliViewCell 利用 autolayout 实现的,这里就不多说了

    主要代码

    1.

        self.tableView.rowHeight = UITableViewAutomaticDimension;

        self.tableView.estimatedRowHeight = 70;

    2.

    -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

    {

        NSLog(@"heightForRowAtIndexPath=:%ld",indexPath.row);

        if( indexPath.row == selectIndex )

        {

            if( !isOpened )

                return 130;

            

            return UITableViewAutomaticDimension;

        }

        else

        {

            return 130;

        } 

    }

     

    -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

    {

        selectIndex = indexPath.row;

        isOpened = !isOpened;

        [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];

    }

  • 相关阅读:
    day2-元组 列表-赋值和深浅拷贝
    day1-bytes类型 三元运算 进制
    DAY02
    DAY02
    Python格式化、显示颜色
    DAY02
    DAY02
    DAY02
    DAY02
    DAY02
  • 原文地址:https://www.cnblogs.com/rollrock/p/4884705.html
Copyright © 2011-2022 走看看