I have a uiwebview in a navigation bar which is in turn inside a tabbar item. I want to know how to hide the tabbar and navigation bar the moment the user takes off his finger from the screen just like hiding the toolbar in the default photos app in the iPhone.
I should also be able to show the tabbar and the navigation bar when i touch my uiwebview again.
By default, a UIWebViewDelegate is not equipped to receive touch events... however, if you subclassed the UIWebView as UIControl (which can accept touch events), you could link the UIWebView's touchUpInside: method provided by UIControl to code that hides the navigation bar.
To hide the navigation bar, you could use:
[self.navigationController setNavigationBarHidden:YES animated:YES];
Then, you could use similar UIControl implementation do detect when a finger has left the UIWebView, etc.
Related
I am creating a reader app and have the kindle app as an
inspiration.
From the reader view (uiscrollview) I wish to present/animate a navigation bar
and toolbar on a tap. Now the app (uiwindow) already has as its root view controller
a navigationVC, which is used for the flow for selecting book category and a book. I then make the top bar invisible when displaying the actual text in my uiscrollview.
I want to display that navigationVC again on a tap, is that possible? I tried in my uiscrollview bind a tapgesturerecognizer to present that controller modally but it didn't work.
Thanks!
It works now, it wasn't as advanced as I thought. Actually, I had an error in my gesturerecognizer handler, which didn't set the UINavigationController's properties :).
I have a custom UIControl subclass with a UIPickerView as inputView. When the control is tapped, it calls becomeFirstResponder and the picker view automatically slides up from the bottom of the screen, like the system keyboard. This is working great!
The problem is that I am using the custom control as the titleView of a UINavigationItem. It functions properly, but if the view controller is popped off the navigation controller stack while the picker view is visible, the animation is wonky.
What I want to happen:
everything is pushed off screen to the right at the same time
What actually happens:
first, the background view and navigation bar slide off screen, the picker remains in place
then, after they are gone, the picker slides off to the right also
When I use the custom control inside the view controller's main view, it animates away just like the standard keyboard. So it seems as though this is a function of "coming from" the navigation bar, which is animated separately from the views inside.
How can I fix this, so that the inputView slides out with the rest of the content?
Turns out this can be fixed by calling endEditing: on the UINavigationController's view. In other words, within a view controller:
[self.navigationController.view endEditing:YES];
This causes the input view to slide down while the rest of the view slides off to the right. Not exactly the same as the system keyboard, but not obviously weird.
I have a small multiview app. It consists of a UITabBarController with a nav controller in each tab. What I want is to show a UIImageView when a user shakes the device. After I've implemented the loading of the UIImageView, I faced a problem-the image was only 2/3 of the screen because of the tab and nav bars. I managed to hide the nav bar but I'm still stuck with the tab bar. I tried many solutions such as [tabBar setHidden: YES]; but I get errors "tabBar undeclared", although I've imported the AppDelegate, where the tabBar was defined.
Thanks in advance!
Try setting
myViewController.hidesBottomBarWhenPushed = YES;
when you create your UIImageView. When you push it on to the view stack the UITabBar will hide automatically, and it will be restored automatically when you pop or dismiss the controller. No need for the application delegate.
If you want to show a full screen view, it is best to use a modal view controller. This way you do have to worry about hiding/showing navigation items. Take a look at:
http://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html
to get started.
In my application, I'm displaying a fullscreen image in a 320 x 480 frame. After I display the image, I fade the navigation bar out to allow the user to see the whole picture. When the user taps in the area where the navigation bar was, I would like to bring the navigation bar back.
This is very similar to what happens in the iPhone Photos app.
Unfortunately, after I've hidden the UINavigationBar, I can't process touches on the screen where the navigation bar once was. I believe this is because the origin of the parent view is right below the navigation bar:
Nav Bar http://shortybox.com/navbar.gif
How can I process touches in this area to bring the nav bar back?
You can override hitTest:withEvent: on UIWindow. See this answer.
Are you fading out, and then removing the bar from its superview? If you just set its alpha to zero, it will still trap your clicks. Try removing it, or hiding it.
It looks like there isn't currently an easy solution to this. The default UINavigationBar is gobbling up all of my events. I ended up hiding the default navigation bar throughout my entire application, and adding a dummy UINavigationBar in interface builder.
By doing so, I lost the default "Back" buttons that come with the NavigationController, but the app is now functional.
ive been looking at some tutorials on a toolbar they all are implemented through the navigation controller delegate. Is there a way i could use the toolbar without using the navigation controller?
right now i have a ViewController with a Scrollview in that scrollview i have images when the user uses a touch gesture then i want a toolbar to be viewable and usable to the user just like on the Photo App.
i want to know how i could use the toolbar and make it functional without going through the app delegate and staying on the current viewController.
A toolbar can be created and positioned just like any other view. Don't confuse toolbars with tabbars.