ここにiPhoneプログラミングの初心者向けの質問があります: メインビューのボタンを押して別のビューに移動するにはどうすればいいですか?ボタンを押したときに次のビューに切り替えるには?
私はボタンを押したときに実行され、以下の機能を持っており、それをデバッグ、彼はそこに渡しますが、私の見解は表示されません「警告」:
-(IBAction) showWarningView:(id)sender
{
if(self.showWarning == nil){
WarningViewController *nextView = [[WarningViewController alloc] initWithNibName:@"Warning" bundle:[NSBundle mainBundle]];
self.showWarning = nextView;
[nextView release];
}
[self.navigationController pushViewController:self.showWarning animated:YES];
}
私の主なRootViewControllerはこのようになります:
#import <UIKit/UIKit.h>
#import "WarningViewController.h"
@interface RootViewController : UIViewController {
IBOutlet UIButton *button1;
WarningViewController *showWarning;
}
@property(nonatomic,retain) WarningViewController *showWarning;
-(IBAction) showWarningView:(id)sender;
@end
私はのUITableViewControllerのナビゲーションコントロールを使用していますが、私はビューベースのアプリケーションで、ボタンを押したときに、単に私の他のビューを表示するために使用するように何がありますか? ありがとう! 、あなたがのUITableViewControllerのナビゲーションコントロールを使用している場合、あなたはおそらくあなたにtableviewcontrollersナビゲーションコントローラ をビューをプッシュする必要があり、これはあなたがあなたのViewControllerへのあなたのtableviewcontrollerのナビゲーションコントローラを通過したことを意味し
を編集し
ええ、彼はとにかく上に書いたのではないですか?彼は実際にそれを使用したくないようだ... – cssmaniac
@dimitri ye、もっと注意深く読むべきだった、今編集しました – gabtub