99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'lib/ios/sugarcube-factories/uialertcontroller.rb', line 99
def self.prompt(controller, title, options = {}, more_options = {}, &block)
text_fields = []
alert = UIAlertController.alert(controller, title, options.merge(show: false), more_options) do |result|
next block.call(text_fields.first.text) if result == 'OK'
next block.call(nil)
end
alert.addTextFieldWithConfigurationHandler(->(s){ text_fields << s })
if options.fetch(:show, true)
controller.presentViewController(alert, animated: true, completion: nil)
end
alert
end
|