我有一個UIViewController,我有一個導航欄和一個表,現在我想從這個視圖導航到另一個視圖上選擇錶行。如何在UIViewController上使用PushViewController?
我該怎麼做?
我有一個UIViewController,我有一個導航欄和一個表,現在我想從這個視圖導航到另一個視圖上選擇錶行。如何在UIViewController上使用PushViewController?
我該怎麼做?
首先,通過右鍵點擊文件和組部分,然後點擊「新文件」選項,並將其命名爲SecondViewController添加新的UIViewController到您的應用程序。
確保您通過選擇「用XIB1用戶界面」添加XIB選項在創建SecondViewController
假設你要推按鈕單擊新視圖,然後添加一個按鈕,你FirstViewController並添加其按鈕的TouchUpInside事件下面的代碼:
SecondViewController *secondView=[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[self.navigationController pushViewController:secondView animated:YES];
[secondView release];
如果你正在使用ARC然後取出[secondView release];
。
讓我知道你是否需要更多幫助。
希望這會有所幫助。
FileName *file=[[FileName alloc] initWithNibName:@"FileName.xib" bundle:nil];
[self.navigationController pushViewController:file animated:YES];
[file release];