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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:16:42+00:00 2026-05-23T23:16:42+00:00

So im conceptually stuck building my app. I’ve read lots of forums but I

  • 0

So im conceptually stuck building my app. I’ve read lots of forums but I think I need to try a new route. Heres what im trying to do.

I created a game where each level loads a different string for the user to play with. Right now the strings for the levels are stored in a plist. There are 5 categories (arrays) each of which contains 20 different strings (ie 20 levels) so there are 100 levels total.

When the user starts the game they reach the “LevelSelect” view which consists of a picker. The picker has two components. the first component is a list of categories, and the second component is the list of levels in that category. The user selects which of the levels they want to play, then press a “Start” button to bring up the “GamePlay” view (an entirely different set of .h, .m, and .xib files).

MY PROBLEM: I dont know how to make the selected level appear on the screen in the Gameplay class. I have all the machinery of the game working, so if I create a string in the viewDidLoad, the game appears to work fine, but I want to have the string for that level come onto the screen when that level is selected and the user presses start.

MY QUESTION: How do I pass the string from LevelSelect to GamePlay?

Thanks for any help you can offer!

  • 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-05-23T23:16:44+00:00Added an answer on May 23, 2026 at 11:16 pm

    If I understand your question correctly, LevelSelect and GamePlay are both subclasses of UIViewController. The user chooses the level he wants to play through the LevelSelect view controller. It sounds like you already know how to display the view for the GamePlay view controller. You just don’t know how to pass a string to that view controller before you display it.

    When the user presses the start button, I presume that you’re currently constructing and presenting your GamePlay view controller with code that looks something like this:

    - (IBAction)startButtonPressed:(id)sender {
        GamePlay *gamePlayViewController = [[[GamePlay alloc] initWithNibName:nil bundle:nil] autorelease];
        [self presentModalViewController:gamePlayViewController animated:NO];
    }
    

    Your goal is give your GamePlay view controller a levelString property that you can set like this:

    - (IBAction)startButtonPressed:(id)sender {
        GamePlay *gamePlayViewController = [[[GamePlay alloc] initWithNibName:nil bundle:nil] autorelease];
        gamePlay.levelString = self.selectedLevelString;
        [self presentModalViewController:gamePlayViewController animated:NO];
    }
    

    where self.selectedLevelString is the string for the level the user selected in the picker.

    To achieve this you’ll need to declare the property in your GamePlay.h file like this:

    @interface GamePlay : UIViewController {
    }
    @property (nonatomic, retain) NSString *levelString;
    @end
    

    In your GamePlay.m file you’ll need to synthesize this property and release it in your dealloc method like this:

    @implementation GamePlay
    @synthesize levelString;
    
    - (void)dealloc {
        self.levelString = nil;
        [super dealloc];
    }
    @end
    

    This gives your GamePlay controller a levelString property, which you can set from your LevelSelect view controller as shown above. Then within any method in the GamePlay view controller, you can access this string using self.levelString.

    By the way, my example code for startButtonPressed: above presumes that you have a property on your LevelSelect view controller called selectedLevelString. You can declare this property the exact same way we declared the levelString property on GamePlay. You can set this string as appropriate when the user selects a level in pickerView:didSelectRow:inComponent:.

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

Sidebar

Related Questions

I'm having trouble understanding OAuth2 conceptually. I've read about the whole handshake process a
This is a practical Domain Driven Design question: Conceptually, I think I get Aggregate
I have a number of classes that are all related conceptually, but some more-so
I'm trying to do something that is conceptually similar to this, but can't seem
New to the WPF world and need to implement a dynamic column view. I
I am quite new to C# and am stuck at the following problem: Out
I think that this is a newbie type question but I have quite understood
Conceptually, I would like to accomplish the following but have had trouble understand how
I have functions that conceptually all return the same thing, but the result can
EDIT I think pretty-mode is conceptually closer to what I want than the various

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.