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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:23:10+00:00 2026-06-18T08:23:10+00:00

‘Can’t get this to work at all ! I had a nice simple class

  • 0

‘Can’t get this to work at all ! I had a nice simple class for a TableView that took up the entire screen, but decided i’d slice it in half, so the table only took the top half of the screen. This is my code:

This is the TableSplitViewController.h

 @interface TableSplitViewController : UIViewController
{
    ChildrenTableViewController *firstController;
    IBOutlet UITableView *firstTable;

}

This is the TableSplitViewController.m:

- (void)viewDidLoad
  { 
[super viewDidLoad];
if (firstController == nil) {
    firstController = [[ChildrenTableViewController alloc] init];
}
    [firstTable setDataSource:firstController];
    [firstTable setDelegate:firstController];
    firstController.view = firstController.tableView;

 }

This is the ChildrenTableViewController.h:

@interface ChildrenTableViewController : UITableViewController

@property (nonatomic, strong) NSMutableArray *childname;

@end

This is the ChildrenTableViewController.m:

    @implementation ChildrenTableViewController

         @synthesize childname;



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

  - (void)viewDidLoad
    {
     [super viewDidLoad];
     self.childname = [[NSMutableArray alloc]
                      initWithObjects:@"Oliver",
                      @"Stuart",
                      @"Ross",
                      @"Alex", nil];
}

   -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
   {
      if ([[segue identifier] isEqualToString:@"ShowChildrenDetails"]) {
            ChildrenDetailViewController *detailViewController = [segue     destinationViewController];

          NSIndexPath *myIndexPath = [self.tableView indexPathForSelectedRow];

          detailViewController.childrenDetailModel = [[NSArray alloc]
                                                    initWithObjects: [self.childname  objectAtIndex:[myIndexPath row]], nil];
     }
  }


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



  - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
   {
    // Return the number of sections.
    return 1;
  } 

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
   {

      // Return the number of rows in the section.
      return [self.childname count];
  }

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
   {
        static NSString *cellIdentifier = @"childrenTablecell";

      ChildrenTableViewCell * cell = [tableView   dequeueReusableCellWithIdentifier:cellIdentifier];
        if (cell == nil) {
          cell = [[ChildrenTableViewCell alloc]
                initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
       }
      // Configure the cell..
      cell.childname.text = [self.childname objectAtIndex:[indexPath row]];


    return cell;
}

This is ChildrenTableViewCell.h:

@interface ChildrenTableViewCell : UITableViewCell
@property (nonatomic, strong) IBOutlet UILabel *childname;

@end

This is ChildrenTableViewCell.m:

@implementation ChildrenTableViewCell

@synthesize childname;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

This is a print screen of the storyboard layout. I’ve attached the label with the childname so it should print the name out :

Screenshot 1

This is a print screen of it running, its weird it has the 4 rows, i can select them, but the labels are not being printed :

![Screenshot 2][2]

Fully appreciate all the help and support you can provide. Thanks 🙂

[2]http://puu.sh/1USzX/512ede1328

Thanks to IOSDEV i managed to find out why it was doing it.

cell.childname.text = [self.childname objectAtIndex:[indexPath row]];
NSLog(@"%@",[self.childname objectAtIndex:[indexPath row]]);
NSLog(@"%@",cell.childname.text);

This is what i put into my code.

and this is what i got:

2013-01-30 15:33:52.465 TableViewStory[17509:907] Oliver
2013-01-30 15:33:52.467 TableViewStory[17509:907] (null)
2013-01-30 15:33:52.470 TableViewStory[17509:907] Stuart
2013-01-30 15:33:52.472 TableViewStory[17509:907] (null)
2013-01-30 15:33:52.473 TableViewStory[17509:907] Ross
2013-01-30 15:33:52.474 TableViewStory[17509:907] (null)
2013-01-30 15:33:52.476 TableViewStory[17509:907] Alex
2013-01-30 15:33:52.477 TableViewStory[17509:907] (null)

So as you can see cell.childname.text is equal to null, this is the reason why the text isn’t coming up 😛 I don’t understand why it is though.

  • 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-18T08:23:11+00:00Added an answer on June 18, 2026 at 8:23 am

    You should use the initWithStyle in the TableSplitViewController.m

    firstController = [[ChildrenTableViewController alloc] initWithStyle:UITableViewStyleGrouped]; 
    

    For some reason when I didn’t use it to init the tableView I had some similar problems.

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

Sidebar

Related Questions

I am doing a simple coin flipping experiment for class that involves flipping a
This is how I get the tags of a body of text. var tags
Does anyone know how can I replace this 2 symbol below from the string
I have just tried to save a simple *.rtf file with some websites and
I've got a string that has curly quotes in it. I'd like to replace
I am trying to create a RegEx expression that will successfully parse the following
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
Hi if i run my project its indicate this logcat error...how to solve this
I need a function that will clean a strings' special characters. I do NOT

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.