Popover shown from inputAccessoryView has wrong rotation - iphone

Does anybody know why a UIPopover or UIActionSheet presented from a UIBarButtonItem in a toolbar in the inputAccessoryView doesn't rotate along with all the other view controllers?
The steps to reproduce this are:
In an Xcode iPad project, add a UILabel editable text field in IB.
Also in IB, add a UIToolbar with a UIBarButtonItem.
In code, set the text field's inputAccessoryView to the toolbar.
Send the becomeFirstResponder message to the text field.
Present an action sheet from the toolbar button item using [actionSheet showFromBarButtonItem:sender animated:YES];
You just need to rotate your iPad to any orientation other than Portrait, and then present the popover to see it happen. If you rotate it while the popover is open, the popover rotates as well so it's in the same weird orientation relative to the rest of the app.
(source: tumblr.com)
Update 2010-08-04 Turns out all popovers and action sheets shown from a item in a toolbar that's an input accessory view (for the keyboard) have this issue. I have submitted a Radar to Apple with Bug ID# 8272121.

Related

Can I pull up a UIActionSheet with a touchable background?

I have a UIPickerView on a UIActionSheet. Right now the UIActionSheet makes the view behind the UIActionSheet not touchable. Is there a way that I can make it touchable? Or is that just how a UIActionSheet works?
I don't believe it is possible to make the view behind the UIActionSheet touchable without dismissing it first. They're meant to be modal, i.e. require the user's attention before being dismissed.
From UIActionSheet class reference (emphasis mine):
For applications running on iPhone and iPod touch devices, the action sheet typically slides up from the bottom of the window that owns the view. For applications running on iPad devices, the action sheet is typically displayed in a popover that is anchored to the starting view in an appropriate way. Taps outside of the popover automatically dismiss the action sheet, as do taps within any custom buttons. You can also dismiss it programmatically.
I suppose a way around this could be that you just create your own view that displays similarly. For example, create a UIView that you can animate the same (slide up) when a button is pressed. This UIView can contain your UIPickerView and whatever else you need (probably a cancel button to dismiss it).
Hope this helps, good luck!

Present UINavigationBar + toolbar modally from UIScrollView

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 :).

How can I restrict modalViewController in Landscape?

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.

How do I dismiss the AirPrint Popover?

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];

Hiding UITabBar when displaying UIPickerView in iPhone SDK

I've got a view when I want to use UIPickerView but my application supports also UITabBar. I want to display UIPickerView in the same spot where keyboard pops up but the problem is that when I do that tab bar buttons are above picker and only half of it is beign displayed. Is is possible to temporary disable tab bar before I draw a picker and restore it when picker will disappear?
Can you show us how you're displaying the UIPickerView? I'll assume you're adding it as a subview to a view controller that is shown from a tab bar, and setting its frame so that it is positioned the same as the keyboard.
In that case, try adding the UIPickerView as a subview to the window, rather than the view controller's view:
[[[UIApplication sharedApplication] keyWindow] addSubview:myPickerView];
This should show it above all other views.
One likely caveat is that if a keyboard needs to be shown at any time while your pickerview is in place, the keyboard will show above your pickerview, hiding it until the keyboard is dismissed again.
What if you called
myTabBarController.tabBar.hidden = YES;
before showing this picker view?