-3

I have a problem,

I am using following code the application work fine.

  Support *panoView=[[Support alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)];
    self.view=panoView;

Note: panoView is UIView class

Instead of this I am using following code:

 Support *panoView=[[Support alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)];
    self.background_image_view=panoView;

This produce following error : Applications are expected to have a root view controller at the end of application launch but app not load.

I need to display panoView inside new background_image_view. Any one help me.

PREMKUMAR
  • 8,283
  • 8
  • 28
  • 51

2 Answers2

2

Instead of [self.window addSubview:] use [self.window setRootViewController:]

in application:didFinishLaunchingWithOptions:

Retterdesdialogs
  • 3,180
  • 1
  • 21
  • 42
0

It looks like the code you posted comes from the loadView method of your view controller. You must assign a value to self.view here, otherwise there is nothing to display for the view controller. This is why your first code snippet works and the second doesn't.

Typically you see this error when you don't assign a value to window.rootViewController in your app delegate's application:didFinishLaunchingWithOptions: method, but I think you are seeing this error because your view controller has no view.

Mike Weller
  • 45,401
  • 15
  • 131
  • 151