Iphone 在UITableView上获取和显示更多记录
嗨,我有大约2500条记录要显示。所有这些数据都来自MySQL数据库。数据将在UITableview中一次显示25条,类似于itunes商店。单击Load More,我需要获取接下来的25条记录 注意:没有仅图像文本 有人做过类似的事情吗?给我示例代码。Iphone 在UITableView上获取和显示更多记录,iphone,uitableview,Iphone,Uitableview,嗨,我有大约2500条记录要显示。所有这些数据都来自MySQL数据库。数据将在UITableview中一次显示25条,类似于itunes商店。单击Load More,我需要获取接下来的25条记录 注意:没有仅图像文本 有人做过类似的事情吗?给我示例代码。在.h的第一行定义int; first in .h define int row; and now in viewDidLoad: row=25; - (NSInteger)tableView:(UITableView *)tableVie
在.h的第一行定义int;
first in .h define int row;
and now in viewDidLoad: row=25;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if([your array count]>row)
return row+1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row<row)
{
cell.textLabel.text=@"Your Text";
}
else{
cell.textLabel.text=@"Load More";
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
if (indexPath.row==row)
{
row=row+25;
[tableView reloadData];
}
现在在viewDidLoad中:行=25;
-(NSInteger)表视图:(UITableView*)表视图行数节:(NSInteger)节{
if([您的数组计数]>行)
返回行+1;
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
如果(indexPath.row您需要从数据库获取记录或将其加载到UITableView中的代码?您必须使用query来获取前25条记录。因此,对于接下来的25条记录,请在Load Click事件中触发另一个查询,然后使用TableView的重载。并且每次单击Load按钮时都要执行此操作……您可以向我发送任何示例代码链接吗?C显示代码并确定遇到的问题?如何从数据库中公开数据?webservice?rest?我使用的是NSXMLParserDelegate..NSMutableURLRequest*request=[NSMutableUrlRequestWithURL:[NSURL URLWithString:url]];