Push View Controller, Black Screen

前端 未结 7 2344
旧时难觅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条回答
  •  情话喂你
    2020-12-14 09:25

    The view controller you are pushing is not having any frame dimension set.It is always recommended to call designated init for objects. For view controllers, designated init method is

    - (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle
    

    if you have a xib assign it like

    ImagesViewController *ivc = [[ImagesViewController alloc] initWithNibName: bundle:[NSBundle mainbundle];
    

    if you are using custom view, assign a frame dimension and add it as subview

提交回复
热议问题