-1

I have a problem about UIActionsheet. When user tap outside action sheet, app will auto call dismiss function to dismiss action sheet, so how can I disable this function? -> User only press cancel button to dismiss action sheet. Thanks,

Zorot
  • 21
  • 6
  • Apple's UI elements should work the same way across all apps to create consistency. Changing the behavior of UIActionSheet like this is not good, and Apple may even reject the app because of this. – Jorn Oct 18 '14 at 13:26
  • Thank Jorn, But follow my design, last button in action sheet is not "Cancel" button and it handle an another function, I can not change UI design. Do you have some tips for me for this problem? – Zorot Oct 18 '14 at 14:04
  • You could use a UIAlertView instead, that way you get more or less the same options, but in a way that forces the user to make a choice :) – Jorn Oct 18 '14 at 14:06
  • I must use action sheet, I must follow UI design, :(, so terrible :( – Zorot Oct 18 '14 at 14:23

2 Answers2

0

UIActionSheet has a delegate method actionSheetCancel:. You can use it to perform some action if the user dismisses the action sheet. Keep in mind that an action sheet may not only be dismissed by tapping outside the action sheet, it could also happen when the app goes into the background. See information about the UIActionSheet delegate here

Jorn
  • 1,054
  • 9
  • 25
0

Don't use .cancel UIAlertActionStyle.

If you remvoe the ".cancel" style, the tapping outside dismiss feature will be disabled.

You need to add your own custom Cancel option and tapping on that button, you can dismiss the action sheet.

Basheer
  • 1,207
  • 9
  • 10