2009-10-15 95 views
1

我對iPhone開發很新,所以如果這是一個新手問題,請原諒我。我有一個用於控制加載各種視圖的RootController應用程序。它最初加載一個MenuView。 MenuView有一個按鈕,當用戶點擊時,我想打開一個完全不同的視圖(稱爲InfoView),該視圖顯示有關應用程序的一些信息以及將用戶帶回MenuView的後退按鈕。如何在按鈕上加載視圖?

有沒有辦法從MenuView調用RootViewController中的IBAction函數?

在此先感謝您的幫助。

回答

0

在您的按鈕操作,你需要做的是這樣的:

UIViewController *nextController = [[UIViewController alloc] initWithNibName:... bundle:...]; 
[self.navigationController pushViewController:nextController animated:YES]; 
[nextController release]; 
0

假設與UIButtons你的工作,你只掛鉤觸摸的內心活動到IBAction爲在Interface Builder中你RootController。如果你在代碼中做這件事,你可以這樣做:

[button addTarget:rootController action:@selector(myActionOnRootController:) forControlEvents:(UIControlEventTouchUpInside)]; 
相關問題