iphone開発に新しい、それについてたくさんの読書をした後、まだUIViewがどのように正しく動作するかを把握しようとしています。私はこれを使って遊んでいましたが、私はこれまでのところです:Objective-c初心者 - UIViewsのヘルプが必要
ビューベースのアプリケーションを使って新しいxcodeプロジェクトを作成しました。私は自分のMMAppViewControllerクラスを持っていて、 "Level1View"という新しいUIViewControllerサブクラスを作成しました。
「Level1」というタイトルのボタンがあり、「Level1View」viewControllerに移動します。このviewControllerには、「次へ」ボタン、「メインメニュー」ボタン(MMAppViewControllerに戻る)、そして現在「レベル1」というタイトルのラベルがあります。
私の問題は、ラベルのタイトルを変更するために使用したコードが機能しないことです。誰がなぜこれが分かっていますか?ここに私のコードです:
@class MMAppViewController;
@interface MMAppAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
MMAppViewController *viewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet MMAppViewController *viewController;
@end
と
@implementation MMAppViewController
-(IBAction)pushLevel1{
Level1View *level1View = [[Level1View alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:level1View animated:YES];
}
...
と
#import <UIKit/UIKit.h>
@interface Level1View : UIViewController {
IBOutlet UILabel *labelTitle;
}
-(IBAction)pushBack;
-(IBAction)pushNext;
@end
と現在
#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 {
...
アプリの実行が、私がヒットしたときにラベルが文句を言わない変更」 「次へ」ボタンをクリックします。誰も助けることができますか?
ええ、私はインターフェイスビルダーでラベルを接続していないし、それはなぜ動作しませんでした!愚かな間違い。ありがとう!質問に答えるときは、答えたと印を付ける方法がありますか?私はちょうど最も適切な答えのチェックをクリックして推測していますか? –