Platforms to show: All Mac Windows Linux Cross-Platform
Last modified Thu, 13th Mar 2024.
You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /iOS/iOS MessageUI
Download this example: iOS MessageUI.zip
Project "iOS MessageUI.xojo_binary_project"
Class App Inherits MobileApplication
End Class
Class Screen1 Inherits MobileScreen
Control SendTextButton Inherits MobileButton
ControlInstance SendTextButton Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
If MFMessageComposeViewController.canSendText Then
Dim pic As Picture = LogoMBS
Dim data As MemoryBlock = pic.ToData(picture.Formats.JPEG)
Dim name As String = "logo.jpg"
MessageComposeViewController = New MFMessageComposeViewController
MessageComposeViewController.subject = "Test Message"
MessageComposeViewController.body = "Just a test message"
Call MessageComposeViewController.addAttachmentData(data, "public.jpeg", name)
MessageComposeViewController.Present
Else
MessageBox "Can't send text."
End If
End EventHandler
End Control
Control SendEmailButton Inherits MobileButton
ControlInstance SendEmailButton Inherits MobileButton
Constraint Constraint 1
Constraint Constraint 2
Constraint Constraint 3
Constraint Constraint 4
EventHandler Sub Pressed()
If MFMailComposeViewController.canSendMail Then
Dim pic As Picture = LogoMBS
Dim data As MemoryBlock = pic.ToData(picture.Formats.JPEG)
Dim name As String = "logo.jpg"
MailComposeViewController = New MFMailComposeViewController
MailComposeViewController.subject = "Test Message"
MailComposeViewController.setMessageBody "Just a test message", False
Call MailComposeViewController.addAttachmentData(data, "image/jpeg", name)
MailComposeViewController.Present
Else
MessageBox "Can't send email."
End If
End EventHandler
End Control
Property MailComposeViewController As MFMailComposeViewController
Property MessageComposeViewController As MFMessageComposeViewController
End Class
Class LaunchScreen Inherits MobileScreen
End Class
Sign
End Sign
Sign
End Sign
Class MFMessageComposeViewController Inherits MFMessageComposeViewControllerMBS
EventHandler Sub didFinishWithResult(result as Integer)
System.DebugLog CurrentMethodName+" "+result.ToString
Me.Dismiss
End EventHandler
End Class
Class MFMailComposeViewController Inherits MFMailComposeViewControllerMBS
EventHandler Sub didFinishWithResult(result as Integer, error as NSErrorMBS)
System.DebugLog CurrentMethodName+" "+result.ToString
If error <> Nil Then
System.DebugLog "Error: "+error.LocalizedDescription
end if
Me.Dismiss
End EventHandler
End Class
End Project
See also:
Download this example: iOS MessageUI.zip
The items on this page are in the following plugins: MBS iOS Plugin.