我從另一個項目複製一個工作的viewcontroller類到一個新的項目。我無法在新項目中加載視圖。在舊項目中,我使用了presentModalViewController。在新的我無法得到加載使用presentModalViewController或presentViewController的視圖無法獲得presentViewController工作
我想從我的主視圖控制器加載目前的視圖。
這裏是我的主視圖控制器界面看起來像......
// ViewController.h
#import <UIKit/UIKit.h>
#import "RequestDialogViewController.h"
@interface ViewController : UIViewController <RequestDialogViewControllerDelegate> {
}
- (void)requestDialogViewDidDismiss:(RequestDialogViewController *)controller withResponse:(NSString*)response;
我使用presentModalViewController這樣的...
RequestDialogViewController *requestIPViewController = [[RequestDialogViewController alloc] initWithNibName:@"RequestDialogViewController" bundle:nil];
navigationController = [[UINavigationController alloc] initWithRootViewController:requestIPViewController];
[self presentModalViewController:navigationController animated:YES];
和presentViewController這樣的...
RequestDialogViewController *requestIPViewController = [[RequestDialogViewController alloc] initWithNibName:@"RequestDialogViewController" bundle:nil];
[self presentViewController:requestIPViewController animated:YES completion:nil];
我在新項目中缺少什麼? init方法觸發,但viewDidLoad不會顯示任何內容。
感謝
哇,這是對我不明顯。我花了一段時間試圖弄清楚這一點。謝謝。 – rjgonzo 2012-11-27 07:11:08
如果在應用程序啓動時發生這種情況 - 顯示的視圖控制器顯示之前,是否仍然存在呈現視圖控制器的閃爍?任何方式在這個?有關上下文,請參閱http://stackoverflow.com/questions/14739461/how-do-you-transition-in-a-new-non-model-view-controller-without-using-uinavigat/14739540#14739540。 – Marplesoft 2013-02-07 00:17:13
這仍然是iOS 10 Xcode 8 Swift 2.3的情況。謝謝! – justColbs 2017-01-09 15:40:57