I am building an iOS app using Rubymotion. I am using the build in email composer but I am having trouble creating the cancel delegate method.
This is how it looks like in Objective C:
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{
[controller dismissModalViewControllerAnimated:YES];
}
This is how I started it in Ruby but it´s wrong:
def MFMailComposeViewController(didFinishWithResult:lambda{ |error|
self.dismissModalViewControllerAnimated(true)
})
Need help to convert from Objective C to Ruby.
It's just a normal method. The lambda is unnecessary.
Also, you want an error pointer per RubyMotion docs: http://www.rubymotion.com/developer-center/guides/runtime/#_pointers
error_ptr = Pointer.new(:object)
def mailComposeController(controller, didFinishWithResult:result, error: error_ptr)
self.dismissModalViewControllerAnimated(true)
end