Push View Controller, Black Screen

前端 未结 7 2350
旧时难觅i
旧时难觅i 2020-12-14 08:55

I\'m pushing to a new view controller and passing some data to it. When I run the application I can press the button and push to a new view but the screen is completely blac

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 09:17

    When you're using a storyboard, and you want to push a view controller in code (rather than with a segue), you need to give the controller an identifier, and create it like this:

        ImagesViewController *ivc = [self.storyboard instantiateViewControllerWithIdentifier:@"MyIdentifier"];
        ivc.label = self.label.text;
        [self.navigationController pushViewController:ivc animated:YES];
    

提交回复
热议问题