MKInputBoxView 0.9.3

MKInputBoxView 0.9.3

测试测试
Lang语言 Obj-CObjective C
许可证 MIT
发布上次发布2015年3月

Martin Kautz 维护。




MKInputBoxView 是一个用来替换 UIAlertView 的类。基本上是 Swift 编写的 BMInputBox 的 Objective-C 版本。

alt tag alt tag alt tag

要求

内置 Objective-C,针对 iOS 8.0 及更高版本。支持 ARC。适用于 iPhone 和 iPad。

将 MKInputBoxView 添加到您的项目中

用法

创建一个输入框

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

可用样式

  • PlainTextInput - 简单文本字段
  • NumberInput - 仅接受数字的文本字段 - 数字键盘
  • PhoneNumberInput - 仅接受数字的文本字段 - 电话键盘
  • EmailInput - 仅接受电子邮件地址的文本字段 - 邮件键盘
  • SecureTextInput - 密码安全文本字段
  • LoginAndPasswordInput - 两个文本字段,用于用户名和密码输入

自定义框

更改模糊效果(UIBlurEffectStyle: 非常淡,淡,深)。

[inputBoxView setBlurEffectStyle:UIBlurEffectStyleDark];

设置标题和消息。

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

设置按钮文本

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

NumberInput 类型的小数。默认为 0。如果设置,则用户输入将被转换为带有两位小数的 Double。

[inputBoxView setNumberOfDecimals:2];

轻松操作 textField 的属性。

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;
};

提交和取消的闭包

inputBoxView.onSubmit = ^(NSString *value1, NSString *value2) {
    NSLog(@"user: %@", value1);
    NSLog(@"pass: %@", value2);
};
inputBoxView.onCancel = ^{
    NSLog(@"Cancel!");
};