Disable UIScrollView when UIActionSheet is displayed - ios

Is there anyway to disable the scrolling when the button for UIActionSheet is pressed?
My app uses horizontal scrolling to access different pages. I also have a bar button item which when pressed calls the UIActionSheet with different options for the user (saving, sharing, etc). But, the user can still horizontally scroll to the next page. Is there a way prevent this such that when the bar button is pressed, the scrolling is disabled?

UIScrollView inherits the userInteractionEnabled property from UIView. Set that to NO when the action sheet is shown (and back to YES when it's dismissed).

Related

UIKeyboardTypeNumberPad hides bottom of view

Newbie alert...
I'm updating some code that has a UITextField with a keyboardType of UIKeyboardTypeNumberPad. In the view, which is in a UIScrollView, there is also a save and cancel button below the textfield. When you tap the textfield, the cancel button is not visible and you cannot scroll to it.
Is there a typical approach for this scenario to make the cancel button accessible when the keyboard pops up?
Is the idea to just manually increase the UIScrollView content size when the keyboard displays and then decrease it when it is dismissed or is there a simpler way of achieving this?

UIPopoverController should prevent scrolling via status bar

I've found that when presenting a UIPopoverController not all controls in the presenting view are disabled. Specifically, the navbar buttons (e.g. 'back') remain selectable. This is a defect in my opinion - it allows the popover to remain on screen, while the view stack pops behind it.
Oh well, at least this can be rectified using self.aboutPopoverController.passthroughViews = nil immediately after presentation.
Except this doesn't disable the status bar, which is often set up to scroll the view's content to the top.
The end result is the ability to present a popover, and then (in the background) scroll the view so that the small arrow/tab on the popover is no longer aligned with the original touch point.
Can anyone shed some light on this behavior? Is it a feature or a bug? Any workarounds?
A simple workaround could be the following:
Just before you display your UIPopoverController set UIScrollView's property scrollsToTop to NO. This way when the user taps on the status bar your scrollView won't scroll.
When you're done with the popover you can re-enable the scrollsToTop functionality.
Here is the UIScrollView documentation:
scrollsToTop
A Boolean value that controls whether the scroll-to-top gesture is enabled.
#property(nonatomic) BOOL scrollsToTop
Discussion
The scroll-to-top gesture is a tap on the status bar. When a user makes this gesture,
the system asks the scroll view closest to the status bar to scroll to the top.
If that scroll view has scrollsToTop set to NO, its delegate returns NO from
scrollViewShouldScrollToTop:, or the content is already at the top, nothing happens.
Hope this helps!

UIButton lazy to change state from normal to highlighted

I have a strange behavior. With Interface Builder I have defined the normal image and the highlighted image state for UIButton but if I tap quickly the button remains in the normal state (but the associated selector is call). The button change state only if I perform a long tap on it.
But if I tap quickly the image doesn't change and the button seems disabled.
If can help I have a view controller with a scroll view attached on it. On this scroll view I have attached a view (that is very long) realized with interface builder.
Ideas ?
This is a feature of UIScrollView. It prioritizes scrolling instead of the button contained within. By setting delaysContentTouches = NO on the parent UIScrollView you should get nice, responsive buttons. However, you won't be able to scroll the parent UIScrollView while touching those buttons.

Present UIPopoverController from a moving rect

Just got this weird problem, where I have a scroll view and buttons in the scroll view. I want to display a UIPopover from the button when touched, with UITextFields inside the UIPopover. The problem comes when the Keyboard appears. In certain cases, when the UIButton is so high in the view that the popover can only be displayed under it with the UIPopoverArrowDirectionUp, and when keyboard pops in, this popover cannot move any more up and therefore magically disappears to the top left corner (probably some Apple thing).
My solution is to check the frame of the UIPopover and to check that there is enough space for the keyboard, and if not, scroll the UIScrollView up with the buttons as well in order to be able to push the UIPopover up and so make sure that both the Keyboard and the popover fit.
So the question is: Is it possible to move the popover as the button moves?
Thanks

iPad popover not resizing properly after search keyboard is dismissed

I have a popover that contains a tableview (which is inside a navigation controller) with custom cells and a search bar in the header. Once I enter the search bar the popover shrinks appropriately to make room for the keyboard. Good so far. Once I dismiss the keyboard either by pressing the search button or the dismiss keyboard button, the popover appears to resize a little but does not does return to the full length as I would expect. I've tried all the suggestions to update the popoversize and contentsizeinpopover. They seem to have no effect.
Any thoughts or workarounds?
Thanks,
Rob

Resources