UITableView transition when drilling down - iphone

I saw this amazing transition in an app: when the user clicks on an item in the tableview and it "drills down" the transition is done "on top" of a background. That is the background image is static and just the actual tableview and whatever is presented after pressing something is moving (from right to left as usual).
How is this layered tableview transition done? Anyone knows?
(the app is "Munch-5-a-day" in the info-view)

Endemic gives you the right direction. Another way can be view controllers with transparent background and then customize UIWindow.

UINavigationController is a subclass of the standard UIViewController class, so it inherits the view property of UIViewController. I would imagine that the background image transition consists of two important steps:
Assign a UIImageView containing the desired background image to the view property of the NavController
Set self.view.backgroundColor = [UIColor clearColor] in each ViewController, most likely in the viewDidLoad method.
I'm currently unable to test this, but it should work.
Reference: UINavigationController Class Reference

Related

Creating a View popup over another ViewController on iPhone

I am trying to make some kind of popup view when a button i pressed on the iPhone. And it would be nice if I could manage that popup view with a ViewController. I have found out that the UIPopoverController could have been the solution, but it seems that it only works on the iPad...
But anyway, are there any similar solutions for the iPhone?
I am using storyboard
Check out these repos on Github:
https://github.com/werner77/WEPopover
https://github.com/50pixels/FPPopover
Create a separate view controller and resize its xib file and make it look like a popup.
Then ADD this view controller as a subview, and also add it as childController too.
[self addChildViewController:self.popOverViewController];
[self.view addSubview:self.popOverViewController.view];
Now Make it hidden initially.
self.popOverViewController.view.hidden = YES;
If a user taps on Button then using fade in & Fade out animation you can hide/unhide it.
I can tell you how to fade in and fade out if you want to know it further, I hope you can do it easily.
In interface builder make a UIView size of the screen and then make another in that Uiview with the style, size and the such for your pop over. Make its class, hook everything together.
CustomPopUpView *view = [[CustomPopUpView alloc] initWithFrame.....]
Add this all to your UIViewController with
[self.view addsubview:view]
Then attach a tapGestureRecognizer to the back view that animates the whole view off screen when tapped. So now if they click off your pop over view it close it will animates it off screen.
Hope this makes sense.
BooRanger

Seeing a ViewController behind the displayed one

Is it possible to view the viewcontroller behind the displayed one? I have a viewcontroller with a scrollview, which has imageviews added as subviews and would like the view that presented this viewcontroller to be visible behind the presented view controller.
I have set all the views, the viewcontroller view too to have a clear color background, but still there is a black background. when I dismiss the viewcontroller, I see 2 layers being dismissed. one has alpha dropped, the other not.
Is there an easy way to make this effect possible?
Its not possible. When a new view controller is pushed or presented as modal view, the previous view controller will be removed from the display(may be UINavigationController/iOS hides it). The rule is only one view controller would be visible at a time. So you will see the color of your window(the black color you've mentioned) in the background.
What you could do is make a screenshot before displaying the other controller. and send this image to new controller to be displayed as background.
This will only work for static content, but you could do something like the curl display.
You can do this but the truth is what EmptyStack says.
You can use setFrame of the subView and add it on the viewController. Also use below method to set the index of the added View. By default currentView has Index 0.
[self.view insertSubview:myView atIndex:0];
or you can try below methods as per your logic
insertSubview:aboveSubview:
insertSubview:atIndex:
insertSubview:belowSubview:
addSubViews:
bringSubviewToFront:
removeFromSuperview:

How to reliably place built-in UINavigationController UIToolbar on top of iPad view

I am trying to use the UINavigationController object's built-in UIToolbar object in my iPad application, but I want it to be displayed on top of the view instead of the bottom, which is where it defaults.
I am also hiding the UINavigationController object's Navigation Bar.
In order to make this work, I had to write the following code:
navigationController.navigationBarHidden = YES;
navigationController.toolbarHidden = NO;
navigationController.toolbar.frame = CGRectMake(0, 0, 768, 44);
This solution works with one exception: when the application Enters Background and Becomes Active again, the Toolbar is always repositioned on the bottom of the view.
I've tried moving the code from viewDidLoad to viewDidAppear:animated, and it still behaves this way.
First, is there any better way to approach this, and if not, how can I stop the Toolbar from being repositioned?
I've also instead decided to use my own UIToolbar object and add it to each view via a custom Base UIViewController class' viewDidLoad. However, this causes the Toolbar to animate when each view is pushed or popped because it is actually part of the view, which just seems "hokey".
Any ideas on possible solutions?
Thanks everyone!
It says in the documentation under UINavigationController's toolbar property that:
Access to this toolbar is provided solely for clients that want to present an action sheet from the toolbar. You should not modify the UIToolbar object directly.
This is sort of hackish, but you could make a UIToolbar yourself and add it directly to the window (i.e. over the navigation controller.)
You can use the category below to modify the UIToolbar class to achieve what you're after.
#implementation UIToolbar (setCenter)
-(void)setCenter:(CGPoint)center
[super setCenter:CGPointMake(384, 22)];
}
#end
The toolbar has limited functionality when used with a UINavigationController. It only provides a convenient way to manage the actionsheet in the toolbar.
From the docs: "Access to this toolbar is provided solely for clients that want to present an action sheet from the toolbar. You should not modify the UIToolbar object directly."
The solution I would use is to create a subclass of UIView with convenience methods to manage your actionsheet and any other custom functionality you need. This custom view can be shared across all views in the UINavigationController and placed where ever you like in the parent view. This will give you ultimate control of your custom top placed toolbar.

iPhone development - how can I implement transparent overlay view?

I'm now working with view-based application. It's just simple. If I touch the view, the view flips using animation ability of UIView. This is all.
What I want to do after this...is...locating a kind of button in the middle of the main view. BUT!, the button must not be animated while the main view is flipping.
How do I do this?
I dont know this is a correct way or not and i havnt tried this. Just a thought.
Create a UIButton in appdelegate and add that button as subview to the UIWindow.
So you can access that button in anyview and so that you can keep that button in the front and change view controllers.

iPhone landscape navigation back action shows vertical view transition?

I have a regular UINavigationController and I push a series of UIViewController into the stack. The view transition for push controller is horizontal animation transition:
[self.navigationController pushViewController:controller animated:YES];
However, when I press the Back button on the navigation bar, the view transition animation is vertical (vertically dropping down the previous controller/view).
I don't seem to find any way to make this horizontal. This happens only in Landscape mode. Portrait mode the transition all happens as horizontal flip transition.
Can anyone shed any light on this?
Thanks
I had the same problem. When I pressed back to get to the first view I saw a vertical animation instead of the normal horizontal one.
I found an answer based on Apple's NavBar sample code. I edited the sample code to add "shouldAutorotateToInterfaceOrientation" to all the view controllers, and made it return YES.
When I ran it I noticed the correct animation was used when pressing "Back".
FIX:
It seems like you need to use your own subclassed UIViewController within the navigation controller, and add shouldAutorotateToInterfaceOrientation. Presumably the default UIViewController isn't returning the correct orientation so the wrong animation is used.
BACKGROUND:
I checked all the differences between my code and Apple's, and I found out that my navigation controller was a subclass of UINavigationController, where I perform all the work. By default IB had added a UIViewController inside this, and I left it alone. I noticed that the NavBar sample code had its own class set (MainViewController). So I made Xcode create a new UIViewController subclass with no xib, then set it up in the Class option in the Identity panel in IB.
I hope this makes sense and helps!