1

I am trying to implement a second scene for the first time and I'm having some issues. Simply trying to display a block of cells in a table view with data from an array. Very similar code to my first scene which is why I'm puzzled as to why it's not working.

Code is below:

#import "ChooseServerView.h"
#import "ViewController.h"

@interface ChooseServerView ()

@end

@implementation ChooseServerView;
@synthesize serverSelection;

- (void)viewDidLoad
{

    serverSelection = [[NSArray alloc] initWithObjects:@"Chicgo, IL",@"London, UK",@"San Jose, CA",@"Washington, DC", nil];
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}


#pragma mark - Table View Methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;              // Default is 1 if not implemented
{
    return 2;
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;    // fixed font style. use custom view (UILabel) if you want something different

{
    if (section == 0) {
        return @"Standard Test Locations:";
    }
    else {
        return @"Quality Test Locations:";
    }
}

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

{
    if (section == 0) {
        return [serverSelection count];
    }
    else {
        return 1;
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

{

    UITableViewCell *stdLocCell = nil;

    stdLocCell = [tableView dequeueReusableCellWithIdentifier:@"serverSelection"];

    if (stdLocCell == nil) {

    stdLocCell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"serverSelection"];

    }

    switch (indexPath.section) {
        case 0:
            stdLocCell.textLabel.text = [serverSelection objectAtIndex:indexPath.row];
            break;
        case 1:
            stdLocCell.textLabel.text = @"Speed Test";
            break;
        default:
            break;
    }

    return stdLocCell;

}

@end

The segue works as expected, the naviagation and tab bar appear but no cells or data, just blank.

There is a note in the output when moving to the new scene that says:

2013-01-03 13:08:34.878 MyConnection[15996:907] Unknown class GLKView in Interface Builder file.

Not sure if that has anything to do with the lack of data or not.

New Class controller is connected to the new scene on the storyboard and appears in the compile instructions as shown below:

Compile Sources

Custom Class

halfer
  • 19,824
  • 17
  • 99
  • 186
Dan
  • 2,304
  • 6
  • 42
  • 69
  • are you sure that you have correctly added GLKView to your default target? http://stackoverflow.com/questions/1725881/unknown-class-myclass-in-interface-builder-file-error-at-runtime – SpaceDust__ Jan 03 '13 at 16:00
  • @SpaceDust I'm not sure of the exact location in that post that I'm meant to be looking? – Dan Jan 03 '13 at 16:15
  • `Using XCode 4, in the Project Navigator, select the .m file that contains the class that it is complaining about` Go to View->Utilities->Show File Inspector (this will show the File Inspector to the right, with that .m-file info) `Open the Target Membership section and make sure that your target is selected for this .m-file` – SpaceDust__ Jan 03 '13 at 16:22
  • @SpaceDust I had assumed that was the section and can verify that the target is selected. I even unchecked, ran the program and checked again as one post suggested to no avail. I can't see where the GLKView class is as I'm not using one, which is confusing me. Is it this error that is stopping the table view from showing? – Dan Jan 03 '13 at 16:26
  • it seems nothing wrong with your code, I would suggest follow and apply each different answer on above link because GLK View is a class of OpenGLES framework it does make no sense you get that warning. – SpaceDust__ Jan 03 '13 at 16:57

1 Answers1

2

Did you hook up the delegate and data source to the view controller. If the table is not looking to your view controller for delegation you would get a blank table view.

ejkujan
  • 3,541
  • 2
  • 15
  • 4
  • I haven't done this, so this is most likely the issue. I'm not 100% sure how to do this correctly so will look into it – Dan Jan 04 '13 at 12:34