First a suggestion, looking at your requirements/code I think you want to create custom view. For creating a custom view, create a class which inherits from UIView
rather than creating a UIViewController
.
Now moving to the code, your btnBar
is a UIViewController
which has its own view self.view
so when you call this [btnBar launchBottomBar]
internally you are adding the bottom bar on self.view
that is your btnBar
controllers view and not on NewView
controllers view
. Hope you understand what I am pointing out.
Here you are missing out few calls,
btnBar.view.frame = CGRectMake(0,self.view.bounds.size.height-40,self.view.bounds.size.width,40); // Add suitable frame.
//This call will add the btnBar's view as subview onto your current view controller's view.
[self.view addSubView:btnBar.view];
This is not correct/recommended way and you can face serious challenges regarding memory leaks. To avoid those mistakes, as I suggested, create a custom UIView
instead. Take a look around on how to create custom views.
Hope that helps!