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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:40:56+00:00 2026-06-10T20:40:56+00:00

I made a simple code for tableView to display some player data; however, I

  • 0

I made a simple code for tableView to display some player data; however, I got the empty table all the time.

This is a table with data fetched from the site.
I want to show the table with player number(as section) and player name(as row).

But after I run the program, it comes out the empty cells and seems no fetching attempt.

Can anyone tell me what’s wrong with my code? Thanks a lot.

#import "playerName.h"

@interface playerName ()
@end

@implementation playerName
@synthesize players = _players;
@synthesize sectionInRtf = _sectionInRtf;

- (NSMutableDictionary *)getPlayerFormRtf
{
    if (!_players) {
        NSURL *url = [NSURL URLWithString:@"file_on_site"];
        _players = [NSMutableDictionary dictionaryWithContentsOfURL:url];
    }
    return _players;
}
- (NSArray *)getSections
{
    if (!_sectionInRtf) {
        _sectionInRtf = [self.players allKeys];
    }
    return _sectionInRtf;
}

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

    self.title = @"Players";
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)viewDidUnload
{
    [super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

#pragma mark - UITableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return self.sectionInRtf.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSArray *namesInSection = [self.players objectForKey:[self.sectionInRtf objectAtIndex:section]];
    return namesInSection.count;
}
//Additional Method
- (NSString *)name:(NSIndexPath *)indexPath
{
    NSArray *nameInSection2 = [self.players objectForKey:[self.sectionInRtf objectAtIndex:indexPath.section]];
    return [nameInSection2 objectAtIndex:indexPath.row];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"players";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    cell.textLabel.text = [self name:indexPath];

    return cell;
}

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}

@end
  • 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-10T20:40:57+00:00Added an answer on June 10, 2026 at 8:40 pm

    This looks like you are trying to override the accessor methods but you are not using the correct naming. I make this assumption since you never actually call getPlayerFormRtf.

    The code should work (though not well) with two simple modifications.

    - (NSMutableDictionary *)players
    {
        if (!_players) {
            NSURL *url = [NSURL URLWithString:@"file_on_site"];
            _players = [NSMutableDictionary dictionaryWithContentsOfURL:url];
        }
        return _players;
    }
    - (NSArray *)sectionInRtf
    {
        if (!_sectionInRtf) {
            _sectionInRtf = [self.players allKeys];
        }
        return _sectionInRtf;
    }
    

    PLEASE note that this is an extremely bad idea, referring to the synchronous loading of a url, since your placeholder url string seems to imply a network access url. This risks blocking the main thread long enough for the application to be killed.

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

Sidebar

Related Questions

I'm having some hard time figuring out what's wrong in this simple code: This
I've made some simple code tests to figure out how this Google-Apps-Script works. Now
I'm using this simple code: http://ejohn.org/blog/simple-javascript-inheritance/ Using this library, I made this simple class:
I have some relatively simple code I have made that is supposed to retrieve
I made a simple code to demonstrate and understand classes - however when I
I made this very simple code for button clicks. Clicking one button changes it's
I've made a simple google search code like this: <div style=text-align:center> <form method=get action=http://www.google.com/search>
I have made a simple code for ajax to call a page but it
I've made a simple benchmark code for redis as below pseudocode. for 10~100 redis
Beginner in Android development. My code crashes. I have made a simple Java method

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.