[quote=397860:@Gregory Moore]
2. Regarding an additional text entry field, yes Jeremie Leroy, thats the kind of thing I wanted to add exactly. How to do it?[/quote]
First you will need Jason King’s iOSKit: https://github.com/kingj5/iOSKit
Add a Property to your iOSView: Private Property alertController as UIKit.UIAlertController
In a button place this code:
[code] using UIKit
alertController = UIAlertController.AlertControllerWithTitleMessagePreferredStyle(“Title”, “Detail”, UIAlertController.UIAlertControllerStyle.Alert)
Dim block As new iOSBlock(AddressOf ConfigTextField)
alertController.AddTextField(block) //This code will be called directly by the UIAlertController just before displaying
Dim alert As UIAlertAction
alert = UIAlertAction.ActionWithTitleStyleHandler("Rename, UIAlertAction.UIAlertActionStyle.Default, WeakAddressOf alertHandler)
alertController.AddAction alert
alert = UIAlertAction.ActionWithTitleStyleHandler(“Cancel”, UIAlertAction.UIAlertActionStyle.Cancel, WeakAddressOf alertHandler)
alertController.AddAction alert
alertController.PresentInView(Self)[/code]
Add a method to your window:
[code]Private Sub ConfigTextField(textfield As ptr)
Declare Sub setText Lib UIKitLib selector “setText:” (obj_id As ptr, value As CFStringRef)
Declare Sub setPlaceholder Lib UIKitLib selector “setPlaceholder:” (obj_id As ptr, value As CFStringRef)
Declare Sub setSecureTextEntry Lib UIKitLib selector “setSecureTextEntry:” (obj_id As ptr, value As Boolean)
'Dim txtField As ptr = Foundation.NSObject.Allocate(NSClassFromString(“UITextfield”))
Dim txt, placeholder As Text, password As Boolean
txt = “Current Value”
placeholder = “Placeholder”
password = False
If txt.Empty = False Then
setText(textfield, txt)
End If
If placeholder.Empty = False Then
setPlaceholder(textfield, placeholder)
End If
If password Then
setSecureTextEntry(textfield, password)
End If
End Sub
[/code]
Add another method to your Window
[code]Private Sub alertHandler(sender as UIKit.UIAlertAction)
If sender.title = “Cancel” Then
alertController.Dismiss
Return
End If
If sender.title = “Rename”
Declare Function text_ Lib UIKitLib selector "text" (obj_id As ptr) As CFStringRef
Dim value As Text
Dim textfields As Foundation.NSArray = alertController.TextFields
Dim Fields() As Text
If textfields <> Nil Then
For q As Integer = 1 To TextFields.count
Dim field As ptr = TextFields.Value(q-1)
fields.Append text_(field)
Next
End If
value = Fields(0)
//Do something with the value returned by the Message Box
End If
alertController.Dismiss
End Sub
[/code]