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: