views:

25

answers:

1

Hi all,

Just because I am unable to find a secure way (in a sense that it can be rejected by Apple guys) to customize UITabbar, in particular UITabBarItem I am trying some workaround. I have a main view on wich I recreate a kind of UITabBar, a normal view with two buttons inside. This is (roughly) the current hierarchy:

-MainView

--placeholder(UIView)

--fakeTab (UIView)

What I want to do is, after tapping a button in fakeTab, build a UINavigationController and add it to "placeholder" view so that the fakeTab remain on top and the whole navigation happens on the placeholder level.

I already tried with this piece of code in the method that it's intercepting tap button, and it works, I can see the ipvc.view added to placeholder.

IPPlantsViewController *ipvc = [[IPPlantsViewController alloc] initWithNibName:@"IPPlantsView" bundle:[NSBundle mainBundle]];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:ipvc];
UIView *placeholder = [self.view viewWithTag:200];
[placeholder addSubview:ipvc.view];

But later when I call from inside ipvc, then nothing happens:

IPAttributes *ipas = [[IPFactory findPlantByIndex:indexPath.row] attrs];
[self.navigationController pushViewController:ipa animated:YES];

I hope I made myself clear :-)

thanks

A: 

I find the solution myself. What I was doing wrong is to attach the ipvc controller view to placeholder. Instead of doing this:

[placeholder addSubview:nav.view];

and everything works as expected, with my fake tabbar fully customized :-)

But, as a side note, the viewWillAppear seems to be never called. It would be interesting to know why. I partially solved by making IPPlantsViewController the delegate of the UINavigationController.

Leonardo