I have an iPhone app with a navigation controller. Views slide in from the right. I want a background picture that is fixed, so that it doesn't slide with the views pushed on the nav controller. Is that possible?
Thanks!
You should be able to, for example, add a UIImageView with your background image as a subview of your app's UIWindow, underneath the UINavigationController's view. Then set the background color of each UIViewController to [UIColor clearColor], and the static background image should show through.
Related
I have a Tabbar application, where clicking on a tabbar item, i should show a Camera Overlay view , BUT it should not HIDE the tabbar, Camera overlay should just fit into the tabbar viewcontrollers, just like behind the tabbar view. I created a custom camera overlay and called UIImagePickerController to my customer camera overlay. But it opens up with full screen mode and hides my tabbar etc.
pickerController.cameraOverlayView = camCumtomOverlay;
I even tried resized the custom camera overlay to small like below, but it open up the camera view with full screen and hides my entire tabbars.
myOwnOverlay = [[[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 300)] autorelease];
But i want to to fit that custom camera overlay into tabbar.
Could someone please advise me how to achieve it?
Thanks!
I presume you're using presentModalViewController: to present the picker. Modal view controllers will go over everything that's behind, so the tabbar will hide as well. You can add a tabbar in the overlay that acts the same as the main tabbar.
I've added a tab bar controller to my app delegate. In IB, I adjusted the alpha property and unchecked opaque, however in the simulator I get transparency over a white background, even though there should be content below it.
Perhaps, the containing View needs to be resized to the full dimensions of the screen? I'm using a nav controller with a tableview in this tab bar item.
What? You want your UITabBar to be translucent? A UITabBar is not a subclass of UINavigationBar, therefore the content from any view controllers the tab controller manages will not appear under the tab bar, if that's what you're trying to do.
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.
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
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