Reputation: 1634
I need to implement Load More Option in tableView . I had received 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:-
"%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.
Upvotes: 1
Views: 5598
Reputation: 4279
When LoadMore is clicked parse xml with next %d value and add them in your array and reload your table [tablename reloaddata];
Upvotes: 1
Reputation: 307
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;
}
}
Upvotes: 1
Reputation: 126
Or try the three20 framework
https://github.com/facebook/three20
There is a class named TTTableViewController that implements Load more button.
Upvotes: 2
Reputation: 1790
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
Upvotes: 4
Reputation: 3111
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".
Upvotes: 1