rubymotion-community / BubbleWrap

Cocoa wrappers and helpers for RubyMotion (Ruby for iOS and OS X) - Making Cocoa APIs more Ruby like, one API at a time. Fork away and send your pull requests
Other
1.18k stars 208 forks source link

fix for when_pressed and uiactionsheet #392

Closed spnkr closed 10 years ago

spnkr commented 10 years ago

without checking for recognizer.state==UIGestureRecognizerStateBegan, if you call a new UIActionSheet from inside a when_pressed handler two identical UIActionSheets are instantiated and displayed:

view.when_pressed do
    UIActionSheet.alert("Log out?", buttons: ['Cancel', "Log out"]) do |pressed|
      if pressed=="Log out"
        #do something
      end
    end        
end

this update fixes when_pressed to work as expected. that is, to only show a single UIActionSheet when the above code is executed.

see also: http://stackoverflow.com/questions/15363311/uigesturerecognizerstatebegan-calling-twice-in-ios-6

markrickert commented 10 years ago

:+1: good to merge.

markrickert commented 10 years ago

Thanks!