zoukankan      html  css  js  c++  java
  • 第三章:IOS Table表视图委托协议和数据协议

    表视图有两个重要的协议

    UITableViewDataSource :数据源协议

     
    方法 返回类型 说明 必须实现
    tableView:cellForRowAtIndexPath:
    UITableViewCell*

       为表视图单元格提供数据,该方法是必 须实现的方法 

    tableView:numberOfRowsInSection:
    NSInteger
    返回某个节中的行数
    
    tableView:titleForHeaderInSection:
    NSString
    返回节头的标题
    
    tableView:titleForFooterInSection:
    NSString
    返回节脚的标题
    
    numberOfSectionsInTableView:
    NSInteger
    返回节的个数
    
    sectionIndexTitlesForTableView:
    NSArray*
    提供表视图节索引标题
    
    tableView:commitEditingStyle:forRowAtIndexPath:
    void
    为删除或修改提供数据
    

    UITableViewDelegate :委托协议,主要用来设定表视图中节头和节脚的标题,并响应一些动作事件 

     
    方法 返回类型 说明 是否需要实现

    tableView:viewForHeaderInSection: 

    UIView * 

    为节头准备自定义视图,iOS 6之后可以使用 UITableViewHeaderFooterView 

    tableView:viewForFooterInSection: 

    UIView * 

    为节脚准备自定义视图,iOS 6之后可以使用 UITableViewHeaderFooterView 

    tableView:didEndDisplayingHeaderView:forSection: 

    void 

    该方法在节头从屏幕中消失时触发(iOS 6之后 的方法) 

    tableView:didEndDisplayingFooterView:forSection: 

    void 

    当节脚从屏幕中消失时触发(iOS 6之后的方法) 

    tableView:didEndDisplayingCell:forRowAtIndexPath: 

    void 

    当单元格从屏幕中消失时触发(iOS 6之后的方法) 

    tableView:didSelectRowAtIndexPath: 

    void 

    响应选择表视图单元格时调用的方法 

     

  • 相关阅读:
    MyBatis——调用存储过程
    企业信息化快速开发平台JeeSite
    JavaWeb网页聊天室(WebSocket即时通讯)
    Java用webSocket实现tomcat的日志实时输出到web页面
    Java用WebSocket + tail命令实现Web实时日志
    linux 跨IP拷贝命令 scp
    在map中根据value获取key
    mysql 常用函数
    Nexus中自定义私服,每个项目都用独立的工厂,仓库
    button 默认类型是submit
  • 原文地址:https://www.cnblogs.com/oscar1987121/p/5231820.html
Copyright © 2011-2022 走看看