当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
1 Star 0 Fork 14

Darkness / LYPaymentField
暂停

forked from city / LYPaymentField
暂停
 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

LYPaymentSecurityField

Travis platform

目录Table of Contents

介绍 Introduction

LYPaymentSecurityField为安全支付输入框,继承于系统的UIControl。它的实现原理比较简单,主要就是利用系统的UIKeyInput。它可以用于支付、安全登陆以及需要安全验证等场景。LYPaymentSecurityField提供了一些基本的方法及属性,例如:

/**
 密码(字符)位数
 */
@property (nonatomic, assign) NSInteger numberOfCharacters;
/**
 已经验证过的(输入满位的)次数
 */
@property (nonatomic, assign, readonly) NSInteger countOfVerification;
/**
 输入满位时的回调
 */
@property (nonatomic, copy) void (^completion)(LYSecurityField *field, NSString *text);
/**
 清空输入
 */
- (void)clear;

同时,LYPaymentSecurityField也提供了一些已经集成了其他UI以及安全输入框的控件,开发者可以直接去使用。

LYPaymentSecurityField is a security payment entry box that inherits from the system's UIControl. It is relatively simple to achieve the principle is to use the system's UIKeyInput.It can be used for payment, safe landing and the need for security verification and other scenes. LYPaymentSecurityField provides some basic methods and properties, such as:

/**
 Password (character) number of bits
 */
@property (nonatomic, assign) NSInteger numberOfCharacters;
/**
 The number of times that have been verified (entered full)
 */
@property (nonatomic, assign, readonly) NSInteger countOfVerification;
/**
 Enter the callback when the number of digits is full
 */
@property (nonatomic, copy) void (^completion)(LYSecurityField *field, NSString *text);
/**
 Empty the characters that have been entered
 */
- (void)clear;

At the same time, LYPaymentSecurityField also provides some have been integrated with other UI and security input box controls, developers can directly use.

截屏 Screenshots

动态演示 Dynamic presentation

模拟器效果不是太好,请到真机上运行^-^

安装方式 Installation

1. 手动拖入

下载demo,将demo中的PaymentField文件夹拖入到自己的工程中,在需要使用的页面,导入LYPaymentSecurityField.h #import "LYPaymentSecurityField.h"

2. Cocopods导入

Podfile里增加 pod 'LYPaymentField' 在需要使用到的页面 #import <LYPaymentSecurityField.h>

1. Manually

Download demo, the demo in the PaymentField folder dragged into their own projects, the need to use the page,import LYPaymentSecurityField.h #import "LYPaymentSecurityField.h"

2. Cocopods

Added in Podfile Pod 'LYPaymentField' In the need to use the page #import <LYPaymentSecurityField.h>

用法 Usage

// 基本用法
self.securityField = [[LYSecurityField alloc] initWithNumberOfCharacters:6 securityCharacterType:SecurityCharacterTypeSecurityDot borderType:BorderTypeHaveRoundedCorner];
    self.securityField.frame = CGRectMake(15, 100, ScreenWidth-30, 50);
    self.securityField.completion = ^(LYSecurityField * _Nonnull field, NSString * _Nonnull text) {
        // 输入满格时被触发
        // TO DO 
    };
    [self.view addSubview:self.securityField];
// 明文Plaintext
self.securityField = [[LYSecurityField alloc] initWithNumberOfCharacters:6 securityCharacterType:SecurityCharacterTypePlainText borderType:BorderTypeHaveRoundedCorner];
    self.securityField.frame = CGRectMake(15, 100, ScreenWidth-30, 50);
    self.securityField.colorOfCharacter = UIColor.blueColor;//文字颜色
    self.securityField.completion = ^(LYSecurityField * _Nonnull field, NSString * _Nonnull text) {
        // 输入满格时被触发
        // TO DO
    };
    [self.view addSubview:self.securityField];
// 短线加密符HorizontalLine
self.securityField = [[LYSecurityField alloc] initWithNumberOfCharacters:6 securityCharacterType:SecurityCharacterTypeHorizontalLine borderType:BorderTypeHaveRoundedCorner];
    self.securityField.frame = CGRectMake(15, 100, ScreenWidth-30, 50);
//    self.securityField.colorOfCharacter = UIColor.brownColor;//文字颜色
    self.securityField.completion = ^(LYSecurityField * _Nonnull field, NSString * _Nonnull text) {
        // 输入满格时被触发
        // TO DO
    };
    [self.view addSubview:self.securityField];
// 自定义加密图片CustomImage
self.securityField = [[LYSecurityField alloc] initWithNumberOfCharacters:6 securityCharacterType:SecurityCharacterTypeCustomImage borderType:BorderTypeHaveRoundedCorner];
    self.securityField.frame = CGRectMake(15, 100, ScreenWidth-30, 50);
    self.securityField.securityImage = [UIImage imageNamed:@"mi"];
    self.securityField.securityImageSize = CGSizeMake(32, 32);//图片默认尺寸25*25,可选
    self.securityField.completion = ^(LYSecurityField * _Nonnull field, NSString * _Nonnull text) {
        // 输入满格时被触发
        // TO DO
    };
    [self.view addSubview:self.securityField];

为核心输入框组件LYSecurityField增加协议方法

/**
 输入完成 end editing
 
 @param paymentField 支付框
 */
- (void)lYPaymentFieldDidFinishedEditing:(LYSecurityField *)paymentField;

/**
 开始输入 begin editing

 @param paymentField 支付框
 */
- (void)lYPaymentFieldDidBeginEditing:(LYSecurityField *)paymentField;

/**
 删除字符 delete a character

 @param paymentField 支付框
 */
- (void)lYPaymentFieldDidDelete:(LYSecurityField *)paymentField;

/**
 清除完成 clear all characters

 @param paymentField 支付框
 */
- (void)lYPaymentFieldDidClear:(LYSecurityField *)paymentField;

为集成的支付弹框组件新增协议方法

@required

/**
 支付密码输入完成

 @param paymentController 弹窗
 @param securityText 输入完成时的输入内容
 */
- (void)lYPaymentController:(LYPaymentAlertController *)paymentController securityTextOfCompeletion:(NSString *)securityText;

@optional

/**
 正在输入密码

 @param paymentController 支付弹框
 @param securityText 输入的密码
 */
- (void)lYPaymentController:(LYPaymentAlertController *)paymentController didEditingSecurityText:(NSString *)securityText;

/**
 清除完成

 @param paymentController 支付弹框
 */
- (void)lYPaymentControllerDidClear:(LYPaymentAlertController *)paymentController;
property note
diameterOfDot 加密黑点的直径
tintColor 前景色
colorOfCharacter 加密图形的颜色
securityImage 自定义加密图片
securityImageSize 自定义加密图片的尺寸
countOfVerification readonly(输入满格)被校验的次数
--- ---

后期计划 TODO

###欢迎大家前来交流经验,希望与大家共同提升,学无止境 QQ:2262932319

MIT License Copyright (c) 2017 cityleaf Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

密码支付框、密码支付弹窗,支持自定义加密图片,自定义支付弹窗 展开 收起
Objective-C
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Objective-C
1
https://gitee.com/abigdreamer/LYPaymentField.git
git@gitee.com:abigdreamer/LYPaymentField.git
abigdreamer
LYPaymentField
LYPaymentField
master

搜索帮助

14c37bed 8189591 565d56ea 8189591