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 6687305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:16:23+00:00 2026-05-26T05:16:23+00:00

This seems to be a very simple thing, but I don’t know how to

  • 0

This seems to be a very simple thing, but I don’t know how to do it.

At moment I have rootView with the continents populated:

enter image description here

The code:

- (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.

    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    //Continent is the class. continents is an array to store data
    Continent *cont=[self.continents objectAtIndex:[indexPath row]]; 
    cell.textLabel.text=cont.continentName;
    return cell;
    }

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Continent *cont=[self.continents objectAtIndex:[indexPath row]];
SelectedContinent* selectedContinent=[[SelectedContinent alloc] initWithNibName: @"SelectedContinent" bundle: nil];

//NSLog(@"%@",cont.continentName);
[self.navigationController pushViewController: selectedContinent animated: YES];
[selectedContinent setTitle:cont.continentName];
[selectedContinent setContinentID:cont.continentID];
[selectedContinent release];
}

I created a new viewcontroller with nib file. Gave him tableView. And now I need to populate the countries from SQLite file. I made a DBAccess class which supposed to do all db manipulations and for every continent was written special method. Then it came to my mind that writing many methods is the stupid idea and the universal method came to world:

-(NSMutableArray*)getTheCountriesEurope:(int)continentID
{
NSMutableArray* euCountriesArray=[[[NSMutableArray alloc]init]autorelease];
NSString* sqlContinents = [NSString stringWithFormat:
                   @"SELECT countries.countryID,countries.countryName\
                   FROM countries\
                   WHERE countries.relativeToContinentID=%i"
                   ,continentID];
/*const char* sqlContinents="SELECT countries.countryID,countries.countryName\
FROM countries\
WHERE countries.relativeToContinentID=?";*/
sqlite3_stmt *statement;
int sqlResult = sqlite3_prepare_v2(database, sqlContinents, -1, &statement, NULL);
if ( sqlResult== SQLITE_OK)
{
    while (sqlite3_step(statement) == SQLITE_ROW)
    {
        Country *countryObj = [[Country alloc] init];
        char *countryName = (char *)sqlite3_column_text(statement, 1);
        countryObj.countryID = sqlite3_column_int(statement, 0);
        countryObj.countryName = (countryName) ? [NSString stringWithUTF8String:countryName] : @"";
        [euCountriesArray addObject:countryObj];
        NSLog(@"%@",countryObj.countryName);
        [countryObj release];
    }
    sqlite3_finalize(statement);
}
else
{
    NSLog(@"Problem with the database:"); 
    NSLog(@"%d",sqlResult);
}
return euCountriesArray;

 }

anyway, this method also has issues and I was told to implement int sqlite3_bind_int(sqlite3_stmt*, int, int); method as well.

Well, at moment my problem is that I can’t to catch the continentID value from RootViewController class I need it to feed to method this value as the parameter.

Have I done right when assigned countryID this way?

 [selectedContinent setTitle:cont.continentName];
 [selectedContinent setContinentID:cont.continentID];

in the RootViewController. If yes, then how to obtain that’s variable’s value?

At moment when I push another view I see only Title (At least it shows right)

SOS

enter image description here

  • 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-26T05:16:23+00:00Added an answer on May 26, 2026 at 5:16 am

    You need to assign the values before you push the view.

    [selectedContinent setTitle:cont.continentName];
    [selectedContinent setContinentID:cont.continentID];
    [self.navigationController pushViewController: selectedContinent animated: YES];

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like it should be very simple but I can't get it to
This seems like a very simple question, but I've only found complicated answers. I've
This seems to me like a very simple question, but I can't seem to
This might be a very simple thing that I'm overlooking, but I just can't
This may seem a very silly question. Consider this: I have a simple Boolean
This is a very simple question, but I can't seem to find something about
I'm sure this is a very simple fix but I cannot seem to find
This seems very basic and I must be missing something, but here goes anyways...
This seems like it should be something very easy to do, but every time
I have an issue that seems like very flaky behavour, is this a problem

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.