Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Perhaps I can clarify what the rest of the group is saying.</p> <p>As you surely know table view must have a datasource that implements at least the two required methods in the <code>&lt;UITableViewDatasource&gt;</code> protocol :</p> <pre><code>– tableView:cellForRowAtIndexPath: – tableView:numberOfRowsInSection: </code></pre> <p>I suspect that your current implementation of <code>– tableView:cellForRowAtIndexPath:</code> just grabs the two strings out of your global collection object, pops them into a cell (hopefully one that's being reused properly!) and returns it.</p> <p>What it probably should be doing is retrieving those data from the database on an as needed basis. I'd implement a class (or classes) to mediate between the app and the database and return blocks of, e.g. 100 rows at a time to whichever class is acting as the datasource (SQLite supports the LIMIT and OFFSET keywords), which will hold onto just that limited set.</p> <p>When <code>– tableView:cellForRowAtIndexPath:</code> is called by the tableView you can check if the data are in the locally stored block (I'd make a property to store the current record offset) and if not, update the local block with a request to the DB for the next (or previous, as the case may be) 100 records.</p> <p>Presto. A fixed number (100) of records are in memory at any given time, the datasource provides data to the table view as needed. You could get fancier, but that's the general idea.</p> <p>As for searching, assuming you're doing a free text search on title, just have the database mediator issue something like</p> <pre><code> 'select id, title, description from yourTable where title like ?' </code></pre> <p>and bind the ? to whatever the user typed, with wildcards in appropriate places (don't forget to sanitize your input... not that anyone's terribly likely to perform SQL injection on your iPhone app, but, habits and all... :)</p> <p>Obviously if you're just searching instead of filtering the results, you'll have to adjust all that a little, but hopefully it's a start.</p> <p>Good luck!</p>
    singulars
    1. This table or related slice is empty.
    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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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