Making a scoreboard on XCode

Hey guys,

I've been working on an iOS app for a few days now and my knowledge of objective C is very poor, so I'm encountering some difficulties. I'm trying to create arrays within arrays, so the way it would work would be I would have 1 array with {1, 2, 3}. Each 1, 2, 3 when run on the simulator would be different options, but it would be 1 prototype cell and 1 array. If I clicked on 1, I want it to lead to array {1a, 1b, 1c}. If I click on 2, I want it to lead to array {2a, 2b, 2c}. I tried nesting an array within array {1,2,3} but it didn't work so great, so I'm super stuck. Any help would be greatly appreciated!!!


To be clearer let me explain what I want my app to do. So I want my app to be able to return scores for our school's sports games. We have 3 seasons of sports, so my initial array would be

{Season 1, Season 2, Season 3}

And in Season 1 we have soccer, cross country, and volleyball. If the user clicks Season 1, I want the next array to be Soccer, Cross Country, and Volleyball. And then the next array to be Results, Standing, Ranking.

So if the user wanted to see Soccer rankings, he'd click into Season 1, then soccer, then rankings.

By 1 prototype cell I mean you can create prototype cells on storyboard on Xcode, and on that view controller I only have 1 prototype cell that references one array.


I have been struggling with this issue for DAYS, and I would like some help.. PLEASE! A gracious angel out there, if you could give us an advice or a sample code, it would be the world to me!!

iOS 6.1.2

Posted on Mar 17, 2013 9:25 AM

Reply
2 replies

Mar 19, 2013 5:41 PM in response to alvinchoi2009

You can't hook a UITableViewCell directly to an array. You should subclass UITableViewController and implement the

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

method. The simplest thing to do would be to make three separate subclasses of UITableViewController, one for each layer of the interface. For the first layer, you would type something like

cell.textLabel.text = [@[@"Season 1", @"Season 2", @"Season 3"] objectAtIndex:indexPath.row];

You would then implement the

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

method, to move to the next layer of the interface.

Alternatively, you could use Static Cells instead of Prototype cells, and then you could use Interface Builder to create the first and second layers. The advantage to this technique is that you don't have to write as much code. The disadvantage is that the array wouldn't be dynamic.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Making a scoreboard on XCode

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.