iPhone UINavigationController : Animate only part of the view - iphone

I have a UINavigationController that contains (from top to bottom) a UINavigationBar, a UIImageView and a UITableView. Every view I will push in the stack contains the same UIImageView at the same place (this is a logo).
I would like the logo to stay just below the UINavigationBar, with no animation when I push/pop views.
Is it possible ?
Thanks

The only way I can think to achieve this would be to add the logo image view directly to the main window in your app delegate. Position it so that it will appear directly below the navigation bar. Then you'll have to set the background color of your view controller's view to clear and ensure that the opaque property is set to NO. Size your view and set the autoresizing mask so that it will be anchored to the bottom of the screen (or to the top of a tab bar or bottom toolbar).
Basically, you need to set up your view controller's view in such a way that there is a portion of the top of the view that is completely transparent. If this is the case, then the logo image view you added directly to the main window will always be visible. When pushing or popping between view controllers using your navigation controller, just ensure that every view controller's view is similarly setup to be transparent at the top right where your logo image view appears. Even if the navigation controller animates the transition, the transparency at the top of your views should only show the opaque portions of your views being animated, along with the navigation bar and its subviews.
Hope that makes sense.
UPDATE: Per Noah Witherspoon's comment, a better approach would probably be just to add your image logo view as a subview of the navigation controller's view. You'll still have to size your view controllers' views so that their contents aren't obscured by your logo image view, but this approach overall is a lot cleaner.

Related

how to add back ground image to navigation controller root view

i want to add bg image to root view so that it will be visible in all views ....
Have a UIImageView behind the navigation controller. Then make the background for the visible view controller of the navigation controller transparent.
As an alternative to using transparency -- make a custom subclass of UIView that you use for your views that go get the background image of the root view. If you make the views transparent, they will look different during animation (slide in/out) than they would if you repeat the image in each view.
i have added image to window in IB of rootview controller that solved my problem

iphone dev - Can UINavigationController animate part of the view?

My app is using a navigation controller and it has a navigation bar, a table view and an image on each view. Those elements layout from top to bottom with no overlapping.
Now because I have the exactly same image for every view (a logo), is it possible to animate only the navigation bar and the table view while the views push and pop? I want the logo always stays on the screen.
Thanks in advance.
Interesting idea. You might try adding the view directly as a subview of the navigation controller's view, rather than making it part of any of the controllers it manages—in that case, you probably also want to give the view a particular tag, then retrieve a reference to it in your individual controllers' -viewWillAppear:animated: and call -bringSubviewToFront: with it on the navigation controller.

How to prevent subview from overlapping tab bar?

I have a view with tab bar at the bottom. This view is pushed on a navigation controller, so there is also a navigation bar at the top. Unto this view, I would like to show a table view, which I create from its own nib. When I add this view as a subview, it overlaps the tab bar.
Is there a way to make this subview automatically resize to the free space in between the top and bottom bar?
If not, what is the 'right' way of adjusting its size to fit?
-Vegar
In the interface builder make sure that you've set the navigation bar and tab bar spacers up. It should be the first list of options on the first tab in the Interface builder Properties view. This will make your view mimic the amount of space it has when loaded in the view.
From there you can also choose the option to clip the subview. The interface builder also allows you to set resize options for the view. If the subview your adding wasn't created in the interface builder you'll have to specify those options manually.
Lastly make sure that your appending the subview to the correct view, and not the tab bar controller or navigation controller.
Best bet is to make sure the subview your addings dimensions are appropriate for the amount of space you have by creating a frame using CGRect.

Add sub views in Navigation Controller

I have a main view which has 3 labels positioned on the top. At the bottom there are about six buttons. On tapping each of the buttons, a different view is to displayed in the center area.
Each of those views have a view controller of its own. In the viewdidload method I set the view frame's y position and height so that it fits in the center area.
This all works if I add those views as subviews. But I want to maintain a view hierarchy. So I tried to use navigation controller. But the problem is the main view goes off screen and the child view is positioned from the top.
How do I solve this problem?
Do you mean the navigation controller supports adding of subviews without taking off the parent view from the screen?

UIScrollView displacement

In my IB I have a navigation controller which has in it a view controller.
When I am trying to load this view controller from another navigation controller the scroll view is being displaced by the size of a navigation bar to the bottom. All other elements of my view are not moving except the scroll view.
Why does it happen and how can I fix this?
Thanks.
In the Size tab of the IB Inspector palette, ensure your scroll view has its autoresizing behaviour set to such:
Likewise, ensure the scroll view's super view is set with the same autoresizing behaviour.