Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6979175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:51:09+00:00 2026-05-27T17:51:09+00:00

I have a class with the following property and method: header file below –

  • 0

I have a class with the following property and method:

header file below – note I did not copy/paste all code (only pertinant information):

@interface SQLiteDB : NSObject

@property (nonatomic, strong) NSMutableArray *allAccountsArray;
@property (nonatomic, strong) NSString *accountId, *accountName, *accountDescription, *accountTags, *accountPhoto, *accountCreationDate;

+(id) populateAccountObjectWithId:(NSString *)id andName:(NSString *)name andDescription:(NSString *)description andTags:(NSString *)tags andPhoto:(NSString *)photo andCreationDate:(NSString *)creationDate;

@end

implementation file below – note I did not copy/paste all code (only pertinant information):

+(id) populateAccountObjectWithId:(NSString *)id andName:(NSString *)name andDescription:(NSString *)description andTags:(NSString *)tags andPhoto:(NSString *)photo andCreationDate:(NSString *)creationDate
{
    SQLiteDB *mySQLiteDB = [[self alloc] init];
    mySQLiteDB.accountId = id;
    mySQLiteDB.accountName = name;
    mySQLiteDB.accountDescription = description;
    mySQLiteDB.accountTags = tags;
    mySQLiteDB.accountPhoto = photo;
    mySQLiteDB.accountCreationDate = creationDate;
    return mySQLiteDB;
}

Then, another method in the implementation file fetches all accounts from the SQLite database:

-(id) fetchAccountList
{   
    // do some database stuff here
    // create prepared statement, open database, etc...

    allAccountsArray = [[NSMutableArray alloc] init];

    while(sqlite3_step(statement) == SQLITE_ROW)
    {
        NSString *thisAccountId =              [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement,0)];
        NSString *thisAccountName =            [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement, 1)];
        NSString *thisAccountDescription =     [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement, 2)];
        NSString *thisAccountTags =            [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement, 3)];
        NSString *thisAccountPhoto =           [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement, 4)];
        NSString *thisAccountCreationDate =    [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement, 5)];

        [allAccountsArray addObject:[SQLiteDB populateAccountObjectWithId:thisAccountId andName:thisAccountName andDescription:thisAccountDescription andTags:thisAccountTags andPhoto:thisAccountPhoto andCreationDate:thisAccountCreationDate]];

    }
    // error handling code, etc.
    // finalize, & close code here...

return allAccountsArray;

}

Now finally the question. In other classes I want to do stuff with the array of objects that this returns. For instance I would do this in a TableVeiw controller:

-(void)loadView
{
    [super loadView];

    mySQLiteDB = [[SQLiteDB alloc] init];
    allAccountsArray = [mySQLiteDB fetchAccountList]; 
}

I would use this later to for instance populate the table list in the cellForRowAtIndexPath method. Perhaps each cell of the table would contain the accountName, accountDescription, and accountCreationDate. I do not however know how to access that name, desc, date from within the array of objects…

This obviously produces an error:

cell.textLabel.text = [allAccountsArray objectAtIndex:indexPath.row];

because the object at “row” is an “object” containing name, desc, date, etc…

So Stackoverflow, I ask you… How do I accomplish getting the object variables at each element of the array?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:51:10+00:00Added an answer on May 27, 2026 at 5:51 pm

    You should be able to do something as simple as this:

    SqliteDB *mySqliteDB = (SQliteDB *)[allAccountsArray objectAtIndex:indexPath.row];
    NSString *myText = mySqliteDB.thisAccountID;
    myText = [myText stringByAppendingString:mySqliteDB.thisAccountName];
    .... etc.
    cell.textLabel.text = myText;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following event class. I have a question related to the Property method
I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,
I am using the XmlSerializer and have the following property in a class public
I have the following dependency property inside a class: class FooHolder { public static
I have the following class structure for custom UITableViewCells: NumericEntryCell - Contains method for
I have a class that has an instance property on it like below Public
I have the following class #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> @interface Bankdaten : NSManagedObject @property
I have created UITableCellView class called NoteCell . The header defines the following: #import
C#, MVC 2 RC 2... I have the following property on my model class:
I have the following class: Public Class Pair(Of T1, T2) Public Property First As

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.