New UITabbar on specific UITableView
I have the following problem:
I have a UITableView with Core Data objects. When I click on one UITableViewCell it shows a detail view controller via pushViewController. Now I want to have on the detail view controller a UITabBar to manage the date easily. On the first UITableView I have also a UITabBar. How can I manage that? Can you please help me? :)EDIT:
Here is my viewDidLoad:viewDidLoad()
{
[super viewDidLoad];
...
UITabBar *newTabBar = [[UITabBar alloc] initWithFrame:CGRectMake(0.0, 367.0, 320.0, 49.0)];
[newTabBar setItems:[NSArray arrayWithObject:self]];
[[self view] addSubview:newTabBar];
}
And my detail view controller when it's pushed:
...
detailViewController = [[DetailViewController alloc] init];
[detailViewController setManagedObjectContext:managedObjectContext];
[[self navigationController] pushViewController:detailViewController animated:YES];
...
And finally the error:
-[De开发者_高级运维tailViewController _updateView]: unrecognized selector sent to instance 0x5a3c190
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[DetailViewController _updateView]: unrecognized selector sent to instance 0x5a3c190'
I'd use a UITabBarController
on the first tableView, then set hidesBottomBarWhenPushed
to YES
on your view controller. On the detail view controller, embed a plain UITabBar
without controller and do the appropriate actions in your UITabBarDelegate
.
The reason is, a UITabBarController
always wants to be at the root of the stack and not to be embedded in a different view controller.
精彩评论