2013-03-25 17 views

Odpowiedz

41

Nie wchodzimy nazwę stalówka na interfejs użytkownika:

SuccessOrFailViewController *sfvc = [[SuccessOrFailViewController alloc] initWithNibName:@"SuccessOrFailViewController" bundle:nil]; 
[self presentViewController:sfvc animated:NO completion:NULL]; 

Dla ujęć jest to do zrobienia:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; 
SuccessOrFailViewController *sfvc = [storyboard instantiateViewControllerWithIdentifier:@"SuccessOrFailViewController"]; 
[sfvc setModalPresentationStyle:UIModalPresentationFullScreen]; 
[self presentModalViewController:sfvc animated:YES]; 
+0

brak "=" w tym statment: SuccessOrFailViewController * sfvc [scenorys instantiateViewControllerWithIdentifier: @ "SuccessOrFailViewController"]; – mikemike396

+0

Edytowałeś odpowiedź i naprawiłeś ją. Thx – Lefteris

+0

Metoda z scenopisami jest całkiem fajna! Thaks – pash3r

1

Dla Storyboard iOS7

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; 
SuccessOrFailViewController *sfvc = [storyboard instantiateViewControllerWithIdentifier:@"SuccessOrFailViewController"]; 
[sfvc setModalPresentationStyle:UIModalPresentationFullScreen]; 
[self presentViewController:sfvc animated:YES completion:nil]; 
6

Swift

var next = self.storyboard?.instantiateViewControllerWithIdentifier("DashboardController") as! DashboardController 
self.presentViewController(next, animated: true, completion: nil) 

nie zapomnij ustawić ViewController StoryBoard Id w StoryBoard ->identity inspector

3

Okrywać ktoś inny znajdzie to, upewnij się, że nie ustawiono self.view.backgroundColor = UIColor.clearColor() w celu pokazać ... To rozwiązać go za mnie.

+0

Hej, to również rozwiązało mój problem. Dzięki. Wiedziałem, że rozwiązanie powinno być proste, ale nie wiem, jaki jest dokładnie problem. – mythicalcoder

+0

Dobrze, musisz dbać o styl prezentacji modalnej https://developer.apple.com/reference/uikit/uiviewcontroller/1621355-modalpresentationstyle – onmyway133

1

Miałem to miejsce po dodaniu i usunięciu kontrolerów widoku w Storyboard i zapomnieniu o zaktualizowaniu kontrolera widoku za pomocą najnowszego identyfikatora Storyboard.

Na przykład, jeśli programowo przeprowadzce do nowego widoku kontrolera, tak (uwaga identyfikator w kodzie jest „FirstUserVC”):

let firstLaunch = (storyboard?.instantiateViewControllerWithIdentifier("FirstUserVC"))! as UIViewController 
self.navigationController?.pushViewController(firstLaunch, animated: true) 

upewnić interfejs Builder masz Storyboard ID ustawione tak z FirstUserVC wymienione w identyczność dla Scenorys ID: enter image description here

Powiązane problemy