Note that there are some explanatory texts on larger screens.

plurals
  1. POLoading records to a TableView - (More button)
    primarykey
    data
    text
    <p>I have like 100 records to display on a table. But i will be only displaying 10 records, and when the user clicks the last row <code>(Which will have a button that will say load the next 10 records)</code> the table will row the next 10 records.</p> <p>I have displayed the more button on the last cell successfully. But i don't know how to display 10 records at a time. My code so far;</p> <p><strong>ViewDidLoad</strong></p> <pre><code>self.arrayThatContainsAllHundredRecords= [NSArray arrayWithArray:hundredRecordsArray]; [self performSelector:@selector(addTheTableFooter:) withObject:nil afterDelay:0.5]; </code></pre> <p><strong>addTheTableFooter</strong></p> <pre><code>UIView* footer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 30)]; [footer addSubview:moreButton]; // i have also added an event to the button click see below, and i have not shown it here. self.tableView.tableFooterView =footer; [self.mainWindow removeFromSuperview]; [self.tableView reloadData]; </code></pre> <p>The above would Display the <code>More</code> button after displaying all <code>100</code> records.</p> <p><strong>moreButtonClickAction</strong></p> <pre><code>-(void)moreButtonClickAction { NSLog(@"Suppose to load the next 10 records"); } </code></pre> <p><strong>numberOfRowsInSection</strong></p> <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.arrayThatContainsAllHundredRecords count]; } </code></pre> <p>I need a way to edit this code, so i will only display 10 records at a time, and display the next 10 when the user clicks the <code>more</code> button. (Now the total records should be 20 - (previous 10 + the 10 records as a result of clicking the <code>more</code> button ))</p> <p>NOTE: I will be downloading all 100 records and saving it in <code>self.arrayThatContainsAllHundredRecords</code> in the <code>viewDidLoad</code> method.</p> <p>I believe that i have to make some change before executing <code>[self.tableView reloadData];</code>, as in tell to load 10 records.</p> <p>Well, say if i only had 53 records. Then the user will click the more button 5 times and on the 6th instance, the table should display only 3 records. How can this be handled in the tableview:numberOfRowsInSection: ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload