Note that there are some explanatory texts on larger screens.

plurals
  1. POObjective-c Novice - Needs help with UIViews
    text
    copied!<p>Im new to iphone development and after lots of reading on it im still trying to figure out how UIViews operate properly. I have been playing about with it and i this is where i am at so far:</p> <p>I have created a new xcode project using the view-based application. I have my MMAppViewController classes and i created a new UIViewController subclass called "Level1View".</p> <p>There is a button titled "Level 1" that takes me to the "Level1View" viewController. In this viewController there is there is a "next" button, a "main menu" button (that returns to MMAppViewController) and there is a label, currently titled "Level 1". </p> <p>My problem is that the code i have used to change the title of label does not work! Does anyone know why this is? Here is my code:</p> <pre><code>@class MMAppViewController; @interface MMAppAppDelegate : NSObject &lt;UIApplicationDelegate&gt; { UIWindow *window; MMAppViewController *viewController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet MMAppViewController *viewController; @end </code></pre> <p>and</p> <pre><code>@implementation MMAppViewController -(IBAction)pushLevel1{ Level1View *level1View = [[Level1View alloc] initWithNibName:nil bundle:nil]; [self presentModalViewController:level1View animated:YES]; } ... </code></pre> <p>and </p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface Level1View : UIViewController { IBOutlet UILabel *labelTitle; } -(IBAction)pushBack; -(IBAction)pushNext; @end </code></pre> <p>and</p> <pre><code> #import "Level1View.h" #import "MMAppViewController.h" @implementation Level1View -(IBAction)pushBack{ MMAppViewController *MainView = [[MMAppViewController alloc] initWithNibName:nil bundle:nil]; [self presentModalViewController:MainView animated:YES]; } -(IBAction)pushNext{ [labelTitle setText:(@"Thanks for playing :)")]; } - (void)didReceiveMemoryWarning { ... </code></pre> <p>Currently the app runs but the label wont change when i hit the "next" button. Can anyone help?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload