iOS Code Snippet Input Dialog (modal) - slightly modified from the Erel one

Similar threads

B4i Code Snippet Input-Dialog
B4A Tutorial [B4X] [XUI] Expandable list based on xCustomListView
B4A Code Snippet [B4X] DownloadAndSave
B4i Library iOS - TouchID
B4i Question iOS 13 SSID and BSSID Problem


Well-Known Member
Licensed User
The original code:

I modified the code to be able to add two buttons, and receive the "Success" parameter to distinguish when the user tap on the positive button or cancel button.

Sub Button1_Click
    Dim no As NativeObject = Me
    no.RunMethod("ShowInputDialog::::", Array("Title", "Text", "Cancel", "Confirm"))
End Sub

Sub InputDialog_Result(Success As Boolean, Text As String)
End Sub

- (void)ShowInputDialog:(NSString*)Title :(NSString*)Message :(NSString*)CancelButtonText :(NSString*)PositiveButtonText{
    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:Title
    /*if (CancelButtonText == @"") {
        CancelButtonText = nil;
    if (PositiveButtonText == @"") {
        PositiveButtonText = nil;
    message:Message delegate:self cancelButtonTitle:CancelButtonText otherButtonTitles:PositiveButtonText, nil];
    alert.alertViewStyle = UIAlertViewStylePlainTextInput;
    alert.delegate = self;
    [alert show];

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    if (buttonIndex == 1) {
        [ raiseEvent:nil event:@"inputdialog_result::" params:@[@1, [[alertView textFieldAtIndex:0] text]]];
    }  else {
        [ raiseEvent:nil event:@"inputdialog_result::" params:@[@0, @""]];
#End If
Something missing: i commented out a block of code, i wanted to check if the text for the two button are empty.. in that case i wish to set the text to "nil" so the button will not be displayed. I did not managed to get that part working, so if someone knows how to do, let's integrate the snippet by commenting below :D