AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
//上述的AppDelegate指的是在建立整個專案時,那個唯一的ApplicationDelegate
appDelegate.viewController <-- 就是目標viewController
所以整個code如下,就用下面這幾行就搞定了:
UIViewController *file = [[UIViewController alloc] ......];
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
[appDelegate.viewController presentModalViewController:file animated:YES]
[file release];
這花了我一堆時間,我還是太嫩....
參考網址:
iOS模态窗口的实现。(横屏问题)