views:

27

answers:

2

Hi all, I have a view, with a navigationBar on top. I add a subview in this view. My subview is a view with a toolBar.

SecondView.frame = CGRectMake(0, 418, 320, 42);

[principalView addSubview:SecondView];
[principalView bringSubviewToFront:SecondView];

After that, the subView is in my principalView, at the right place, but when I click in the subView, nothing happen.

But, if my navigationBar is like this, all works perfectly,

self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;

Why the subview do nothing if my navigationBarStyle is UIBarStyleDefault.

Alex

A: 

I recommend just using Interface Builder to do this. Also, normally you don't use navigation bars by themselves. Normally if you have a navigation bar you should use a UINavigationController and push view controllers onto that.

Nimrod
I use uinavigationcontroller
alex
+2  A: 

I think your SecondView has fallen out of your principalView bounds. If that's the case, it will still be visible because principalView does not clip subviews, but SecondView will not respond to user action. You should check the principalView.bounds property against SecondView.frame.

tia
the property bounds is in IB or I set this programmaticaly.
alex
I set the bounds property or my principalView to 0,0,320,460 but I have the same problem...
alex
Could you try setting your principalView.backgroundColor to [UIColor redColor] or some color, and set your toolbar frame a little bit smaller, and check it again?
tia