views:

28

answers:

2

Hey all,

I have a navigation view controller and I want a subview ( just a view and not a view controller) to slide on top of it when a button in the parent view is clicked. Now, the thing is when I do this:

[parentView addSubview:slideView];

[UIView beginAnimations]

//setting the frame for sliding

[UIView CommitAnimations]

the sliding view goes under the navigation bar after sliding. I would like it to slide on top of the navigation bar of the parent view. How do I achieve this?

Essentially, all I am trying to do is: replicate the iPhone Add Contact application with the only difference being; unlike me, they don't have a navigation controller on the parentView but just a navigation bar with a system add button.

Anyone!!

A: 

You have to add the view (which should be over the navigation bar) as a subview to the navigation bar.

brutella
@brutella Can you illustrate what you said with a code snippet?
Bogus Boy
[navigationBar addSubview:slideView];
brutella
that won't work brutella
Bogus Boy
+1  A: 

if you use:

[self.navigationController presentModalViewController:view];

that will slide up a view (I think) over the navigation bar.

Thomas Clayson
@Clayson, Like I said, the sliding view is not a view controller but just a view. Do I have to convert this view into a viewController.view?
Bogus Boy
I don't know - I'm convinced that it works with a UIView but if not then just make your UIView into a UIViewController. A UIViewController has a view element (myViewController.view). :)
Thomas Clayson
Hey Clayson, turns out, it doesn't work with UIViews. Had to convert it into viewController.view to achieve what I wanted. Got it done finally. Thanks for all the help.
Bogus Boy