3
我使用下面的代碼調用設置頁面的形式表過的viewController:viewDidAppear和viewWillAppear中沒有得到所謂的在iPad上
NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
NSString *device = [standardUserDefaults objectForKey:@"Device"];
if ([device isEqualToString:@"iPhone"]) {
Settings_iPhone *screen = [[Settings_iPhone alloc] initWithNibName:nil bundle:nil];
screen.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:screen animated:YES];
[screen release];
}
if ([device isEqualToString:@"iPad"]) {
Settings_iPhone *screen = [[Settings_iPhone alloc] initWithNibName:@"Settings_iPad" bundle:nil];
screen.modalPresentationStyle = UIModalPresentationFormSheet;
screen.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:screen animated:YES];
[screen release];
}
當設置頁面被調用,並駁回,viewDidAppear和viewWillAppear中是未在iPad上僅在原始頁面上調用。在iPhone上,由於它不是一張表格,所以它完美地工作,而且當我將iPad上的設置頁面作爲常規模態視圖而不是表單時,它們都會被調用。請幫忙。謝謝!
那麼你可以使用委託來完成你的任務,你想在你的viewDidAppear/viewWillAppear中的事。要不看http://useyourloaf.com/blog/2010/5/3/ipad-modal-view-controllers.html瞭解ModalViewController如何工作的完整場景。 –
基本上,如果設置更新任何值,我需要在屏幕上更新這些值,那麼我將如何能夠做到這一點? – Prajoth
閱讀有關KVO .. –