Tus*_*ani 12 cocoa-touch objective-c uitableview ios4
嘿,任何人都可以指导我通过这个我在表中有大约15个条目我希望另外15个在最后一个UITableViewCell中提出更多的负载.谁能帮助我?
Sri*_*iya 19
在tableview中显示一个额外的行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return dataRows+1;
}
Run Code Online (Sandbox Code Playgroud)
在
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
//after setting tableviewcell
if(indexPath.row==dataRows){
cell.textLabel.text=@"Load More Rows";
}
}
Run Code Online (Sandbox Code Playgroud)
在
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row==dataRows){
//there you can write code to get next rows
}
}
Run Code Online (Sandbox Code Playgroud)
您需要根据显示的行更新numberOfRows变量.
编辑:获取额外条目后,可以使用以下方法将它们添加到现有条目数组中.您的原始数组应该是NSMutableArray
使用此方法.
[originalEntriesArray addObjectsFromArray:extraEntriesArray];
归档时间: |
|
查看次数: |
13159 次 |
最近记录: |