Latest 0.9.3
Homepage https://github.com/planetexpress69/MKInputBoxView
License MIT
Platforms ios 8.0, requires ARC
Authors

MKInputBoxView is a class to replace UIAlertView. It is basically an Objective-C port of BMInputBox, which is written in Swift.

alt tag
alt tag
alt tag

Requirements

Built in Objective-C for iOS 8.0 and above. ARC-enabled. For both iPhone and iPad.

Adding MKInputBoxView To Your Project

CocoaPods

CocoaPods is the recommended way to add MKInputBoxView to your project. Just add

pod 'MKInputBoxView'

and run
pod install. It will install the most recent version of MKInputBoxView.

If you would like to use the latest code of MKInputBoxView use:

pod 'MKInputBoxView', :head

Alternatively, just add MKInputBoxView.hand MKInputBoxView.m to your project.

Usage

Creating an input box

MKInputBoxView *inputBoxView = [MKInputBoxView boxOfType:NumberInput];
[inputBoxView show];

Available styles:

  • PlainTextInput – Simple text field
  • NumberInput – Text field accepting numbers only – numeric keyboard
  • PhoneNumberInput – Text field accepting numbers only – phone keyboard
  • EmailInput – Text field accepting email addresses – email keyboard
  • SecureTextInput – Secure text field for passwords
  • LoginAndPasswordInput – Two text fields for user and password entry

Customising the box

Changing the blur effect (UIBlurEffectStyle: ExtraLight, Light, Dark).

[inputBoxView setBlurEffectStyle:UIBlurEffectStyleDark];

Set title and message.

[inputBoxView setTitle:@"Who are you?"];
[inputBoxView setMessage:@"Please enter your username and password to get access to the system."];

Set text of the buttons

[inputBoxView setSubmitButtonText:@"OK"];
[inputBoxView setCancelButtonText:@"Cancel"];

Decimals for the NumberInput type. Default is 0. If set, the user input will be converted to Double with 2 decimals.

[inputBoxView setNumberOfDecimals:2];

Easy way to manipulate the textField’s properties.

inputBoxView.customise = ^(UITextField *textField) {
    textField.placeholder = @"Your eMail address";
    if (textField.secureTextEntry) {
        textField.placeholder = @"Your password";
    }
    textField.textColor = [UIColor whiteColor];
    textField.layer.cornerRadius = 4.0f;
    return textField;
};

Closures for submission and cancellation

inputBoxView.onSubmit = ^(NSString *value1, NSString *value2) {
    NSLog(@"user: %@", value1);
    NSLog(@"pass: %@", value2);
    if ([value1 isValid] && [value2 isValid]){
    return YES; // YES to hide the inputBoxView
    } else {
    return NO; // NO will keep the inputBoxView open
    }
};
inputBoxView.onCancel = ^{
    NSLog(@"Cancel!");
};

Latest podspec

{
    "name": "MKInputBoxView",
    "version": "0.9.3",
    "summary": "A tiny class to replace UIAlertView.",
    "description": "MKInputBoxView is a tiny class that lets you replace UIAlertView with a better customizable view.",
    "homepage": "https://github.com/planetexpress69/MKInputBoxView",
    "screenshots": [
        "http://teambender.de/pub/github/MKInputBoxViewLoginAndPassword.png",
        "http://teambender.de/pub/github/MKInputBoxViewNumber.png",
        "http://teambender.de/pub/github/MKInputBoxViewPlainText.png"
    ],
    "license": "MIT",
    "authors": {
        "planetexpress69": "[email protected]"
    },
    "source": {
        "git": "https://github.com/planetexpress69/MKInputBoxView.git",
        "tag": "0.9.3"
    },
    "social_media_url": "https://twitter.com/planetexpress69",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "MKInputBoxView/**/*"
}

Pin It on Pinterest

Share This