• UITableView


    什么是UITableView

    在众多移动应用中,能看到各式各样的列表数据

    在iOS中,要实现展示列表数据,最常用的做法就是使用UITableView
    UITableView继承自UIScrollView,因此支持垂直滚动,而且性能极佳

    UITableView的两种样式

    如何展示数据

    UITableView需要一个数据源(dataSource)来显示数据

    UITableView会向数据源查询一共有多少行数据以及每一行显示什么数据等

    没有设置数据源的UITableView只是个空壳

    凡是遵守UITableViewDataSource协议的OC对象,都可以是UITableView的数据源

    tableView和数据源

    tableView展示数据的过程

    1.调用数据源的下面方法得知一共有多少组数据
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;

    2.调用数据源的下面方法得知每一组有多少行数据
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

    3.调用数据源的下面方法得知每一行显示什么内容
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

  • 相关阅读:
    Python有返回值的函数_布尔函数
    struts通配符*的使用
    实现action的三种方法
    filter
    struts常量<constant>说明
    dtd文件本地配置
    namespace
    Spring的第一个例子
    SSH新学,关于面向对象的看法
    @OneToMany---ManyToOne
  • 原文地址:https://www.cnblogs.com/xufengyuan/p/6857326.html
Copyright © 2020-2023  润新知