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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:11:59+00:00 2026-06-16T17:11:59+00:00

Please bear with me as I am completely new at objective-c. Thanks in advance

  • 0

Please bear with me as I am completely new at objective-c. Thanks in advance for any help you can provide!

So here is basically what I am trying to accomplish: I have 3 main tables whose contents will never change, that I therefore chose to construct in the mainstoryboard. Think of these are different grouping drilled down step by step into more and more details. So you have:

Table 1 (higher level to table 2) > Table 2 (higher level to table 3) > Table 3

Now I need to add a 4th table, but whose contents will be changed, based on a CSV file. For now I am ignoring how use CSV files and there seems to be quite a bit of info on this already. So I am electing to use Arrays using (NSArray) to store and retrive the information.

I first build the prototype of this table in the mainstoryboard so that I have an idea of what it will look like. Then I wrote the code below which ideally will update the information in table 4:

VIEWCONTROLLER.H file
#import <UIKit/UIKit.h>

@interface ViewController : UITableViewController
<UITableViewDataSource, UITableViewDelegate>

@end

VIEWCONTROLLER.M file

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController


NSArray *nominalManagers;
NSArray *tipsManagers;
NSArray *tipsAmt;
NSArray *nominalAmt;

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;


    tipsManagers = [[NSArray alloc]
                    initWithObjects:
                    @"SSG",
                    nil];

    tipsAmt = [[NSArray alloc]
                    initWithObjects:
                    @"$tip",
                    nil];

    nominalManagers = [[NSArray alloc]
                    initWithObjects:
                    @"Wel",
                    @"Gold",
                    @"Colch",
                    @"Stand",
                    nil];

    nominalAmt = [[NSArray alloc]
                    initWithObjects:
                    @"$Wel",
                    @"$Gold",
                    @"$Colch",
                    @"$Stand",
                    nil];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
    // Return the number of rows in the section.
    NSUInteger rowNum;
    if (section == 0) {
    rowNum = 1;
    }
    else if (section == 1) {
    rowNum = 4;
    }
    else {
    rowNum = 0;
    }

    return rowNum;

}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
    }

    // Configure the cell...
    NSUInteger row = [indexPath row];
    NSInteger section = [indexPath section];

    switch (section) {
        case 0: // First cell in section 1
            cell.textLabel.text = [tipsManagers objectAtIndex:[indexPath row]];
            cell.detailTextLabel.text = [tipsAmt objectAtIndex:[indexPath row]];
            break;
        case 1: // Second cell in section 1
            cell.textLabel.text = [nominalManagers objectAtIndex:[indexPath row]];
            cell.detailTextLabel.text = [nominalAmt objectAtIndex:[indexPath row]];
            break;
        default:
            cell.textLabel.text = @"WRONG SECTION";
            break;
    }

    return cell;
}

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }   
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Navigation logic may go here. Create and push another view controller.
    /*
     <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
     // ...
     // Pass the selected object to the new view controller.
     [self.navigationController pushViewController:detailViewController animated:YES];
     */
}

@end

My main issue is that I am unable to connect the delegate and sourcedata of this class to Table 4 (the table whose information will change). Can you help? Do you have any suggestions to better accomplish my goal?

  • 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-06-16T17:12:00+00:00Added an answer on June 16, 2026 at 5:12 pm

    What I understand from your question is you do not have a uitableview to connect your data source and delegate !?

    I am not sure if you have added 4th viewcontroller to your storyboard yet, If not just add a UItableviewcontroller to your storyboard, create a push segue then in identity inspector choose your VIEWCONTROLLER as class name.

    Add IBOutlet UITableViewto your .h file like below and in your interface builder connect your datasource and delegate. When you need refresh your tableview call [self.tableviewname reloadData];

    You can use NSMutableArray to edit the items in your array, if you use NSArray array items will be static.

    VIEWCONTROLLER.H file

    #import <UIKit/UIKit.h>
    
    @interface ViewController : UITableViewController
    <UITableViewDataSource, UITableViewDelegate>
    
    @property (nonatomic, weak) IBOutlet UITableView *fourthTable;
    
    @end
    

    VIEWCONTROLLER.M file

        @implementation ViewController
        @synthesize fourthTable;
    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        // Uncomment the following line to preserve selection between presentations.
        // self.clearsSelectionOnViewWillAppear = NO;
    
        // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
        // self.navigationItem.rightBarButtonItem = self.editButtonItem;
    
    
        tipsManagers = [[NSArray alloc]
                        initWithObjects:
                        @"SSG",
                        nil];
    
        tipsAmt = [[NSArray alloc]
                        initWithObjects:
                        @"$tip",
                        nil];
    
        nominalManagers = [[NSArray alloc]
                        initWithObjects:
                        @"Wel",
                        @"Gold",
                        @"Colch",
                        @"Stand",
                        nil];
    
        nominalAmt = [[NSArray alloc]
                        initWithObjects:
                        @"$Wel",
                        @"$Gold",
                        @"$Colch",
                        @"$Stand",
                        nil];
    
     [self.fourthTable reloadData];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please bear with me, I'm new at C and I'm trying to program an
Please bear with me, I'm new here - and I'm just starting out with
first question, hoping someone can help here. I've been trying to track down how
I'm new to both Objective-C and the iPhone SDK in general, so please bear
I'm extremely new to mvc and webtest so please bear wtih me here. I
I am completely new to XSLT so please bear with me. I have two
Please bear with me as I am new to dojo, javascript, and web programming
Please bear with me if this isn't clear, this is my first posting here.
Please bear in mind that I'm totally new to Rails when answering this.My question
please bear with my newbie questions.. I was trying to convert PDF to PNG

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.