Search code examples
iosuiscrollviewuiactionsheet

Disable UIScrollView when UIActionSheet is displayed


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?


Solution

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