I am trying to add a UITabBarController to a UIViewController:
[self.view addSubView:tabBarController.view];
I get a warning:
warning: 'UIView' may not respond to '-addSubView:'
How can I add a 开发者_运维问答UITabBarController to my UIViewController?
The specific warning you are getting is because you are spelling the method name wrong; try addSubview:
instead of addSubView:
.
But, aside from that problem, you may still have difficulty getting the UITabBarController to work correctly in a subview, because it's not intended to be used that way. The UITabBarController Class Reference says:
When deploying a tab bar interface, you must install this view as the root of your window. Unlike other view controllers, a tab bar interface should never be installed as a child of another view controller.
*emphasized text*replace with this----
[self.view addSubview:obj.view];
精彩评论