PushViewController Leads To Black Screen

后端 未结 7 599
暗喜
暗喜 2020-12-10 13:46
SettingsViewController *viewController = [[SettingsViewController alloc] init];
    [[self navigationController] pushViewController:viewController animated:YES];
         


        
7条回答
  •  醉酒成梦
    2020-12-10 13:57

    so you could initialise using the name of the xib or storyboard as everyone is suggesting and that’s valid.

    Although if you’re using storyboards and your initial viewcontroller is on the storyboard, they maybe rather do the following,

    // Method in your initial viewcontroller 
    - (void)youPushMethod { 
    
    // Name your segue on your storyboard, e.g. SegueIndentifier 
    [self performSegueWithIdentifier:@"SegueIndentifier" sender:self];
    }
    

    Then,

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    
         if ([segue.identifier isEqualToString:@“SegueIndentifier"]) {
         SettingsViewController *settingsViewController= segue.destinationViewController;
        }
    }
    

提交回复
热议问题