UITableView

要让 UITableViewController 实现 UITableViewDataSource 协议,须要实现如下方法:spa

1. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;code

指定section数blog

所谓的section,我目前的理解,就是相似通信录里面的按照首字母分块A、B、Cit

 

2. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;io

指定每一个section的row数table

 

3. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPathclass

指定对应cell的内容queue

初始化cell有两种方法:方法

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

UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"ToDoEventCell"];
相关文章
相关标签/搜索