zoukankan      html  css  js  c++  java
  • 一个界面中如何使用两个tableView

     

    一个界面中如何使用两个tableView

    分类: IPhone开发高级系列

    首先,创建两个全局的tableview;

     @interface TianPinXunLiViewController ()

    {

        UITableView *leftTableView;

        UITableView *rightTableView;

    }

    @end

    其次,实现代理的时候,用对象比对的方法  A isequal B

    #pragma - mark TableView Datasouce

    -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

        if ([tableView isEqual:leftTableView]) {

            return 14;

        }

        else if ([tableView isEqual:rightTableView])

        {

            return 10;

        }

        return 0;

    }

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

        if ([tableView isEqual:leftTableView]) {

            static NSString *identifier = @"myCell";

            LeftCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];

            if (!cell) {

                cell = [[[LeftCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]autorelease];

            }

            return cell;

        }

        else if ([tableView isEqual:rightTableView])

        {

            static NSString *identifier = @"mycell";

            RightCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];

            if (!cell) {

                cell = [[RightCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];

            }

            return cell;

        }

        return nil;

    }

  • 相关阅读:
    合并字符串中的多个空格
    IfcSpecularRoughness
    IfcSpecularExponent
    IfcPresentableText
    IfcFontWeight
    IfcFontVariant
    uwb ifc模型定位測試
    IfcFontStyle
    IfcGeometricModelResource
    qt6安装
  • 原文地址:https://www.cnblogs.com/shupaopao/p/4359762.html
Copyright © 2011-2022 走看看