Skip to content
This repository

Looking for fmdb example / demo - iOS #64

Open
ns-1m opened this Issue April 29, 2012 · 4 comments

1 participant

Noli Sicad
Noli Sicad
ns-1m commented April 29, 2012

If you are looking for a simple fmdb example for iOS, you can get one here.

http://blog.objectgraph.com/index.php/2010/04/08/how-to-use-sqlite-with-uitableview-in-iphone-sdk/

Probably some one can improve this demo, add as feature in this example i.e. things that mentioned in the readme.

Noli Sicad
ns-1m commented May 11, 2012

I manage to run the SampleTableView project mentioned in the link above in Xcode 4.2 iOS 5.0.

However, setText is deprecated. How do we fix this problem?

[cell setText:[[mAnimal objectAtIndex:indexPath.row] retain]];

Anyway, this demo works!

Any other fmdb demo?

Here is complete code:

#############
// Customize the appearance of table view cells.

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    /* These are the Default Methods we don't need to configure them */

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    /* Configure the cell.
    We have to start configuring cells from here
    */

    [cell setText:[[mAnimal objectAtIndex:indexPath.row] retain]];

    /* set the Accessory Type to our Cells like ">"*/

    [cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];

    return cell;
    }

Noli Sicad
ns-1m commented May 11, 2012

Please note this one as well.

http://blog.objectgraph.com/index.php/2010/04/08/how-to-use-sqlite-with-uitableview-in-iphone-sdk/

Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1

I checked the files added for fmdb and found there was an fmdb.m file that needs removed as it also contains a main method!

In other words, Don't add fmdb.m in project inorder to work.

Noli Sicad
ns-1m commented May 12, 2012

This one works.

// Customize the appearance of table view cells.

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell.
    //We are configuring my cells in table view

    /* FunnyQuotes quote = (FunnyQuotes) */ NSString *lData = [aLion objectAtIndex:indexPath.row];
    cell.textLabel.text = lData;

    return cell;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.