I have a singleton popover, so that I only show one popover at a time. When I do my share popover, and choose AirPrint, the share popover correctly goes away, showing the AirPrint popover in its place.
But if I press the share button again, the share popover displays on top of the AirPrint popover.
I can't find a way of referencing the AirPrint popover to dismiss it.
Some further information - I have UIBarButtonItems on a toolbar at the bottom of the screen, and four UIBarButtonItems nested inside a navigationBar's rightBarButtonItem at the top of the screen.
The UIBarButtonItems at the bottom of the screen correctly dismiss the AirPrint popover automatically, but the nested ones at the top do not.
But if I knew the name of the AirPrint popover, I could dismiss it from the top buttons' code.
The actual "AirPrint" UIPopoverController is not available to you. However, if you need to make it go away programmatically, you do:
[[UIPrintInteractionController sharedPrintController] dismissAnimated:YES];
You should be able to dismiss Printer popover view as below code.
UIPrintInteractionController *pic = [UIPrintInteractionController sharedPrintController];
[pic dismissAnimated:YES];
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 am working on iPad application where I am showing some view in modalView controller.
In Landscape, when I click on UITextField for taking some input modalview controller goes up and keyboard appears.
But I have changed the height of modalViewController and I dont want the modalView goes up for keyboard. How can I do this? Any help?
In the UIViewController's code, where you move its modalViewController, check if the interface orientation is not landscape
if(([self.interfaceOrientation!=UIInterfaceOrientationLandscapeLeft])
&&([self.interfaceOrientation!=UIInterfaceOrientationLandscapeRight]))
//your code to repostion the view controlled by the modalViewController
I guess you have to use custom presentation code. You cannot change the scrollup behaviour, when the keyboard appears.
You could add a 1024*768 sized black transparent view on top of the window and then your view on top of this. But you would have to build your own borders around your view in that case. Probably there are some open-source implementations of a modal popover. You can search for that on cocoacontrols etc.
I am working on an app which has UITabBar at the bottom of app. One of the tab holds UITableviewController and another holds UIViewController. UITableViewController is customized to hold grid of images. When I tap on these images, my App pushes another view in navigationcontroller but at this time I remove tabbar and put toolbar. So far everything works fine. But when I go back to parent view I see white space at the bottom of it. I am hiding toolbar in viewWilldisapper so that I can not see on parent view.
Can anyone tell me where I am going wrong?
Regards,
Sumit.
You don't need to hide toolBar in viewWillDisappear. When you use the method hidesBottomBarWhenPushed to hide tabbar it will automatically hides and display when you push and pop. Try removing the piece of code where you are hiding toolBar in viewWillDisappear.
I have a fairly complicated issue which I will describe as good as possible.
I have an iPad App and a SplitviewController as my main view. In Portrait mode, the SplitviewController hides the Tableview to the left, so that the DetailviewController is visible only. So far so good.
The way you use this, is, from what I understand, that if I tap on a cell to the left, I replace the Detailview to the right with a new view I want to show. To this end, I use the viewControllers property.
Now to display the Popover I have a Toolbar at the top and a Menu Button to display the Popover.
Here's the thing:
I tap on a cell, and replace the DetailviewController with a new Viewcontroller. But now the Popovercontroller is gone, since it was declared in the header of the old ViewController.
The problem: When I tap on the Menu Button in port mode, the popover cant be displayed, since it is nil now, as it wasnt initiated yet.
But what I can do is: I rotate the iPad to the landscape, and rotate it back again. The popover is back, bacause in the delegate method of the splitviewcontroller the following happens:
- (void) splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {
self.popoverController = pc;
}
Where does this pc come from? How can I do that myself.
If I try to re-alloc the Popovercontroller this breaks the SplitviewController and artifacts in the App appear.
I hope I explained my problem well enough.
Any ideas?
Take a look at this sample code from Apple:
http://developer.apple.com/library/ios/samplecode/MultipleDetailViews/Introduction/Intro.html
It demonstrates how to switch between different detail views by tapping on items in the table in the split view app's lefthand view.
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.