MMCaptchaView 1.3

MMCaptchaView 1.3

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Mar 2019

Maintained by LEA.



  • By
  • Cheery Lau

MMCaptchaView

License MIT  CocoaPods  CocoaPods 

MMCaptchaView

CocoaPods

  1. pod "MMCaptchaView";
  2. pod install / pod update;
  3. #import <MMCaptchaView.h>.

示例:

_captchaView = [[MMCaptchaView alloc] initWithFrame:CGRectMake((self.view.bounds.size.width-150)/2, 200, 150, 50)];
_captchaView.captchaFont = [UIFont boldSystemFontOfSize:30];
[_captchaView setCaptchaCompletionBlock:^(NSString *captcha) {
    NSLog(@"验证码:%@",captcha);
}];
[self.view addSubview:_captchaView];

提供一个不区分大小写的比较方式:

BOOL isMatch = [self.captchaTextField.text caseInsensitiveCompare:_captchaView.captcha] == NSOrderedSame;
if (isMatch) {
    NSLog(@"验证码输入正确!!");
} else {
    NSLog(@"验证码输入错误!!");
}

后记

不定时更新,如有问题欢迎给我留言,我会及时回复。如果这个工具对你有一些帮助,请给我一个star,谢谢。