Load More Option In TableView?
I need to implement Load More Option in tableView . I had receive开发者_如何转开发d data from the web services in XML and i had parsed the XML files through the XML Api URLs and display the data in the UITableView.
API URL is like:-
http://www.xyz.com/api_tm.php?page_id=%d
"%d" this is the place holder for the Page No. there are 10 pages from (1 to 10) and each page has 15 News which i display on UITableView.
Now I want "LoadMore" option in the table view for when user click on load more option then value of "%d"place holder is changing from 1 to 2 and so on and load the next 15 news of page 2 on the tableView with the preexist news of page 1 and again showing the load more option for next pages.
Can any one suggest me the way to implement the "LoadMore" option in the UITableView.
Thanks In Advance.
Instead use Load More Button in Footer View of tableview & reload tableview for every page count.
or Try this Links
https://github.com/sishen/LoadMoreTableFooterView
https://github.com/kwylez/LoadMore
Or try the three20 framework
http://thre20.info
https://github.com/facebook/three20
There is a class named TTTableViewController that implements Load more button.
I think use face book's "pull down to refresh" way is the most user-friendly approach, only different it yours will be "pull up to load more".
Just add a button in 11 th cell by using indexPath.row
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
if (indexPath.row == 11)
{
UIButton *btnMore = [[UIButton alloc]initWithFrame:CGRectZero];
btnMore.backgroundColor=[UIColor clearColor];
btnMore.font=[UIFont fontWithName:@"Arial" size:15.0];
[btnMore setFrame:CGRectMake(10,10,100,44)];
[cell addSubview:btnMore];
[btnMore release];
return cell;
}
}
When LoadMore is clicked parse xml with next %d value and add them in your array and reload your table [tablename reloaddata];
精彩评论