In the Twitter for iPhone application (the app formerly known as Tweetie) there is nifty effect when pushing from the tweet view controller to the account view controller.
The name of the account, the profile image and the users name stay fixed in position while the navigation controller animates pushing a new controller on to the stack. Does anyone know how this is achieved?
I've tried pushing a non-animated viewcontroller on to the stack and overriding the viewDidAppear:animated: method but met with no luck.
It's possible those view items are not subviews of the viewcontroller's view. They could be subviews of a higher level view or subviews of the window or another window.
Related
I've had a lot of experience customizing UINavigationBars and find it is a royal pain in the a** to get it to do what I want without a lot of effort. So I've written my own custom UIView that behaves just like a UINavigationBar and is fully and easily customizable. However, I am having a problem, when the Navigation controller pushes a new controller onto the stack, my custom view stops receiving touch events.
To make this more clear, my app loads and displays a view controller, in the viewDidLoad method, I create and add my custom nav bar to the controller's view. A navigation controller is created programmatically and a view controller is pushed to it. At this point my custom view is on top and receiving touch events. When I push another view controller to the navigation controller's stack, my custom view is still on top and visible, but not receiving events.
So my question is how to I get my custom nav bar back into the responder chain?
Thanks for your help!
If you don't have to support iOS < 5.0 you should try to add the UINavigationBar using UINavigationController's - (instancetype)initWithNavigationBarClass:(Class)navigationBarClass toolbarClass:(Class)toolbarClass method instead of doing it manually.
I'm a bit confused as to implementing custom view controllers. I have a view that I want to have slide down from the top of the window. The view has three buttons on it. When the button for the view to drop is tapped the view drops. And when tapped again the view slides up/goes away. I have the drop down view saved as a nib file. Would this be the best method for implementation? Or should I have the view in the main view's nib?
And could I get some direction on how I should set it up?
The usual pattern has each of the view's stored in their own XIB file and associated with their own view controller objects. You then alloc/init the new view controller and point it to its XIB and present it modally. Once its presented, its VC responds to its actions and interacts with the model and updates its own views. You can then dismiss that view controller and its views to revert back to the parent view controller.
I have noticed a pattern mentioned in SO where people alloc/init a child VC and then within their present VC they addSubview the newVC.view, but that just seems pretty unusual to me.
If you just have a subview that is being animated down to partially cover the screen, perhaps it doesn't warrant its own VC since, as I think I'm understating your usage, its actions would map to your current VC. In that case, I would either create its contents programmatically or just as another view in the XIB for your first VC and animate that down when needed.
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.
I have my views that are part of a tabBar. Each view has a navigationController.
In one of my views I have an embeded xib component. This is a scrolling view
with UIButtons inside it.
I want to slide in another view, inside the navigationController when a person taps the button. I can get the taps, etc.
BUT, I can't figure out how to find the controlling navigationController of that page to push the new view into. Nothing seems to work that I have tried.
IS this possible?
Thanks
You need to pass a reference to the navigation controller "down" your view hierarchy. Or pass another object that has a reference to the navigation controller "down". Or get the app delegate if it has a reference to the navigation controller.
I have an app that uses a UINavigationController as its main way of showing data.I want a Settings screen to pop up, but I also want to be able to push new views for Settings. From what I've found, I can't use a UIViewController do to this. How can I present a view by sliding it, and also have content pushed onto it?
You can display the view for your view controller subclass either by presenting it modally (slides from the bottom and takes over the whole screen) or pushing it onto the navigation stack with animation (slides from the right and keeps the navigation bar).
In either case, you control the content of the view using your view controller subclass. Typically you update labels and controls in the viewWillAppear method.