UIViewController adding subview gives me error: unrecognized selector

I get the following error, and I'm not sure what causes it.

2011-02-06 23:38:12.580 SApp[9648:207] -[Record superview]: unrecognized selector sent to instance 0x5f2a350
2011-02-06 23:38:12.583 SApp[9648:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Record superview]: unrecognized selector sent to instance 0x5f2a350'

Steps that create the error:

  • My custom class is added to the app delegate window.
  • My class is a subclass of UIViewController.
  • In my custom class, I add subview (Record), which is another subclass of UIViewController. - THIS is when the error occurred.

Error code :

[self.view addSubview:[self.tabBarControllers objectAtIndex:0]];

I have all my .h files where they should be, so I'm not sure what causes this. And ideas?

+3
source share
1 answer

UIViewController () . , , .

UIViewController *recordController = [self.tabBarControllers objectAtIndex:0];

[self.view addSubview:recordController.view];
+12

Source: https://habr.com/ru/post/1790397/


All Articles