Commit 228336f4 authored by Keil's avatar Keil

初始化 kankanshenghuo_ios 仓库,忽略 Pods 依赖目录。

Co-authored-by: 's avatarCursor <cursoragent@cursor.com>
parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

*~
.DS_Store
*.xcuserstate
*.xcworkspace
xcuserdata
# CocoaPods
Pods/
File added
//
// TBCycleView.h
// TBCycleProgress
//
// Created by qianjianeng on 16/2/22.
// Copyright © 2016年 SF. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void(^TBCycleViewBlock)(void);
typedef NS_ENUM(NSUInteger, TBCycleViewType) {
TBCycleViewTypeUnAnimation,
TBCycleViewTypeProgress,
TBCycleViewTypeCoinScale,
TBCycleViewTypePackageScale,
TBCycleViewTypePackageShake,
TBCycleViewTypeCoinsNumberShow,
TBCycleViewTypeNumber
};
@interface TBCycleView : UIView
- (instancetype)initWithFrame:(CGRect)frame count:(NSInteger)count number:(NSString *)number block:(TBCycleViewBlock)block;
- (void)showAnimationWithVC:(UIViewController *)vc;
- (void)resetAnimation;
- (void)pauseAnimation;
- (void)resumeAnimation;
//- (void)setCoinsWithNumber:(NSString *)number;
@end
This diff is collapsed.
//
// EmptyView.h
// KKCivilAd
//
// Created by 雷俊博 on 2019/11/30.
// Copyright © 2019 雷俊博. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface EmptyView : UIView
@end
NS_ASSUME_NONNULL_END
//
// EmptyView.m
// KKCivilAd
//
// Created by 雷俊博 on 2019/11/30.
// Copyright © 2019 雷俊博. All rights reserved.
//
#import "EmptyView.h"
@implementation EmptyView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="EmptyView">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="empty_authenticationList_icon" translatesAutoresizingMaskIntoConstraints="NO" id="NPx-L6-K0T">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="NPx-L6-K0T" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="4aO-he-GQ7"/>
<constraint firstItem="NPx-L6-K0T" firstAttribute="trailing" secondItem="vUN-kp-3ea" secondAttribute="trailing" id="Ok3-GM-o4O"/>
<constraint firstItem="NPx-L6-K0T" firstAttribute="bottom" secondItem="vUN-kp-3ea" secondAttribute="bottom" id="Tbr-XD-5eA"/>
<constraint firstItem="NPx-L6-K0T" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="luC-0f-TdG"/>
</constraints>
<viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
<point key="canvasLocation" x="132" y="130"/>
</view>
</objects>
<resources>
<image name="empty_authenticationList_icon" width="101.5" height="107"/>
</resources>
</document>
//
// KKFiveRedPackage.h
// Open
//
// Created by 雷俊博 on 2021/7/30.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef void (^KKFiveRedPackageClickBlock)(BOOL success);
@interface KKFiveRedPackage : UIView
+ (void)showWithBlock:(KKFiveRedPackageClickBlock)block;
@end
NS_ASSUME_NONNULL_END
//
// KKFiveRedPackage.m
// Open
//
// Created by 雷俊博 on 2021/7/30.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import "KKFiveRedPackage.h"
@interface KKFiveRedPackage ()<UIGestureRecognizerDelegate>
/** 弹窗主内容view */
@property (nonatomic,strong) UIView *contentView;
@property (nonatomic, copy)KKFiveRedPackageClickBlock block;
@end
@implementation KKFiveRedPackage
- (instancetype)initWithBlock:(KKFiveRedPackageClickBlock)block
{
self = [super init];
if (self) {
self.block = block;
[self setupUI];
}
return self;
}
- (void)setupUI
{
self.frame = [UIScreen mainScreen].bounds;
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapClick:)];
tap.delegate = self;
[self addGestureRecognizer:tap];
//------- 弹窗主内容 -------//
self.contentView = [[UIView alloc] init];
self.contentView.frame = CGRectMake(0, 0, 304 * WIDTHRADIU, 330 * WIDTHRADIU);
self.contentView.center = self.center;
[self addSubview:self.contentView];
self.contentView.backgroundColor = [UIColor clearColor];
//背景图片
UIImageView *bgImg = [[UIImageView alloc]initWithFrame:self.contentView.bounds];
bgImg.image = [UIImage imageNamed:@"fiveRedPackage"];
[self.contentView addSubview:bgImg];
//按钮
UIImageView *btnImg = [[UIImageView alloc]init];
btnImg.image = [UIImage imageNamed:@"fiveRedPackage_open"];
[self.contentView addSubview:btnImg];
[btnImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.bottom.offset(- 65 * WIDTHRADIU);
make.width.height.offset(90 * WIDTHRADIU);
}];
CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"transform.scale"];
animation.fromValue=[NSNumber numberWithFloat:1.1];
animation.toValue=[NSNumber numberWithFloat:0.9];
animation.duration=0.25;
animation.autoreverses=YES;
animation.repeatCount=HUGE_VALF;
animation.removedOnCompletion=NO;
animation.fillMode=kCAFillModeForwards;
[btnImg.layer addAnimation:animation forKey:@"zoom"];
UIButton *clickBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[clickBtn addTarget:self action:@selector(clickBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:clickBtn];
[clickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.bottom.offset(- 65 * WIDTHRADIU);
make.width.height.offset(90 * WIDTHRADIU);
}];
UIImageView *closeImg = [UIImageView new];
closeImg.image = [UIImage imageNamed:@"guide_close"];
[self addSubview:closeImg];
[closeImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.top.equalTo(self.contentView.mas_bottom).offset(30 * WIDTHRADIU);
make.width.height.offset(30 * WIDTHRADIU);
}];
}
#pragma mark - UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if ([touch.view isDescendantOfView:self.contentView]) {
return NO;
}
return YES;
}
+ (void)showWithBlock:(KKFiveRedPackageClickBlock)block
{
KKFiveRedPackage *alertView = [[KKFiveRedPackage alloc]initWithBlock:block];
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
[keyWindow addSubview:alertView];
}
#pragma mark - event response
- (void)clickBtnClick:(UIButton *)sender
{
if (self.block) {
self.block(YES);
}
[self dismissUI];
}
- (void)tapClick:(UITapGestureRecognizer *)tap {
[self dismissUI];
}
#pragma mark -隐藏弹框
- (void)dismissUI
{
[self removeFromSuperview];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// GuideAlertView.h
// Open
//
// Created by 雷俊博 on 2021/7/29.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef void (^GuideAlertViewClickBlock)(BOOL success);
typedef void (^GuideAlertViewCloseBlock)(BOOL success);
@interface GuideAlertView : UIView
+ (void)showWithImageName:(NSString *)imageName VC:(UIViewController *)vc Block:(GuideAlertViewClickBlock)block;
+ (void)showInWindowWithImageName:(NSString *)imageName Block:(GuideAlertViewClickBlock)block;
+ (void)showInWindowWithImageName:(NSString *)imageName VC:(UIViewController *)vc Block:(GuideAlertViewClickBlock)block close:(GuideAlertViewCloseBlock)close;
@end
NS_ASSUME_NONNULL_END
//
// GuideAlertView.m
// Open
//
// Created by 雷俊博 on 2021/7/29.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import "GuideAlertView.h"
@interface GuideAlertView ()<UIGestureRecognizerDelegate>
/** 弹窗主内容view */
@property (nonatomic,strong) UIView *contentView;
@property (nonatomic, copy)NSString *NetimageName;
@property (nonatomic, copy)NSString *imageName;
@property (nonatomic, copy)GuideAlertViewClickBlock block;
@property (nonatomic, copy) GuideAlertViewCloseBlock close;
@end
@implementation GuideAlertView
- (instancetype)initWithImageName:(NSString *)imageName Block:(GuideAlertViewClickBlock)block
{
self = [super init];
if (self) {
self.imageName = imageName;
self.block = block;
[self setupUI];
}
return self;
}
- (instancetype)initWithNetImageName:(NSString *)imageName Block:(GuideAlertViewClickBlock)block close:(GuideAlertViewCloseBlock)close
{
self = [super init];
if (self) {
self.NetimageName = imageName;
self.block = block;
self.close = close;
[self setupUI];
}
return self;
}
- (void)setupUI
{
self.frame = [UIScreen mainScreen].bounds;
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapClick:)];
tap.delegate = self;
[self addGestureRecognizer:tap];
//------- 弹窗主内容 -------//
self.contentView = [[UIView alloc] init];
self.contentView.frame = CGRectMake(0, 0, 320 * WIDTHRADIU, 350 * WIDTHRADIU);
self.contentView.center = self.center;
[self addSubview:self.contentView];
self.contentView.backgroundColor = [UIColor clearColor];
//背景图片
UIImageView *bgImg = [[UIImageView alloc]initWithFrame:self.contentView.bounds];
bgImg.userInteractionEnabled = YES;
[self.contentView addSubview:bgImg];
UIButton *clickBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[clickBtn addTarget:self action:@selector(clickBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:clickBtn];
if (self.NetimageName.length > 0) {
[bgImg sd_setImageWithURL:[NSURL URLWithString:self.NetimageName]];
clickBtn.frame = self.contentView.bounds;
}else{
bgImg.image = [UIImage imageNamed:self.imageName];
[clickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.bottom.offset( - 15 * WIDTHRADIU);
make.width.offset(255 * WIDTHRADIU);
make.height.offset(44 * WIDTHRADIU);
}];
}
UIImageView *closeImg = [UIImageView new];
closeImg.image = [UIImage imageNamed:@"guide_close"];
[self addSubview:closeImg];
[closeImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.top.equalTo(self.contentView.mas_bottom).offset(30 * WIDTHRADIU);
make.width.height.offset(30 * WIDTHRADIU);
}];
}
#pragma mark - UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if ([touch.view isDescendantOfView:self.contentView]) {
return NO;
}
return YES;
}
+ (void)showWithImageName:(NSString *)imageName VC:(UIViewController *)vc Block:(GuideAlertViewClickBlock)block;
{
GuideAlertView *alertView = [[GuideAlertView alloc]initWithImageName:imageName Block:block];
[vc.view addSubview:alertView];
}
+ (void)showInWindowWithImageName:(NSString *)imageName VC:(UIViewController *)vc Block:(GuideAlertViewClickBlock)block close:(GuideAlertViewCloseBlock)close;
{
GuideAlertView *alertView = [[GuideAlertView alloc]initWithNetImageName:imageName Block:block close:close];
[vc.view addSubview:alertView];
}
+ (void)showInWindowWithImageName:(NSString *)imageName Block:(GuideAlertViewClickBlock)block
{
GuideAlertView *alertView = [[GuideAlertView alloc]initWithImageName:imageName Block:block];
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
[keyWindow addSubview:alertView];
}
#pragma mark - event response
- (void)clickBtnClick:(UIButton *)sender
{
if (self.block) {
self.block(YES);
}
[self dismissUI];
}
- (void)bgImgtap{
if (self.block) {
self.block(YES);
}
[self dismissUI];
}
- (void)tapClick:(UITapGestureRecognizer *)tap {
if (self.close) {
self.close(YES);
}
[self dismissUI];
}
#pragma mark -隐藏弹框
- (void)dismissUI
{
[self removeFromSuperview];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// GuideMoneyTreeAlertView.h
// Open
//
// Created by 雷俊博 on 2021/7/29.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef void (^GuideMoneyTreeAlertViewClickBlock)(BOOL success);
@interface GuideMoneyTreeAlertView : UIView
+ (void)showWithImageName:(NSString *)imageName VC:(UIViewController *)vc Block:(GuideMoneyTreeAlertViewClickBlock)block;
@end
NS_ASSUME_NONNULL_END
//
// GuideMoneyTreeAlertView.m
// Open
//
// Created by 雷俊博 on 2021/7/29.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import "GuideMoneyTreeAlertView.h"
@interface GuideMoneyTreeAlertView ()<UIGestureRecognizerDelegate>
/** 弹窗主内容view */
@property (nonatomic,strong) UIView *contentView;
@property (nonatomic, copy)NSString *imageName;
@property (nonatomic, copy)GuideMoneyTreeAlertViewClickBlock block;
@end
@implementation GuideMoneyTreeAlertView
- (instancetype)initWithImageName:(NSString *)imageName Block:(GuideMoneyTreeAlertViewClickBlock)block
{
self = [super init];
if (self) {
self.imageName = imageName;
self.block = block;
[self setupUI];
}
return self;
}
- (void)setupUI
{
self.frame = [UIScreen mainScreen].bounds;
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapClick:)];
tap.delegate = self;
[self addGestureRecognizer:tap];
//------- 弹窗主内容 -------//
self.contentView = [[UIView alloc] init];
self.contentView.frame = CGRectMake(0, 0, 335 * WIDTHRADIU, 326 * WIDTHRADIU);
self.contentView.center = self.center;
[self addSubview:self.contentView];
self.contentView.backgroundColor = [UIColor clearColor];
//背景图片
UIImageView *bgImg = [[UIImageView alloc]initWithFrame:self.contentView.bounds];
bgImg.image = [UIImage imageNamed:self.imageName];
[self.contentView addSubview:bgImg];
UIButton *clickBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[clickBtn addTarget:self action:@selector(clickBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:clickBtn];
[clickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.bottom.offset(0);
make.width.offset(255 * WIDTHRADIU);
make.height.offset(44 * WIDTHRADIU);
}];
UIImageView *closeImg = [UIImageView new];
closeImg.image = [UIImage imageNamed:@"guide_close"];
[self addSubview:closeImg];
[closeImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.top.equalTo(self.contentView.mas_bottom).offset(30 * WIDTHRADIU);
make.width.height.offset(30 * WIDTHRADIU);
}];
}
#pragma mark - UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if ([touch.view isDescendantOfView:self.contentView]) {
return NO;
}
return YES;
}
+ (void)showWithImageName:(NSString *)imageName VC:(UIViewController *)vc Block:(GuideMoneyTreeAlertViewClickBlock)block;
{
GuideMoneyTreeAlertView *alertView = [[GuideMoneyTreeAlertView alloc]initWithImageName:imageName Block:block];
[vc.view addSubview:alertView];
}
#pragma mark - event response
- (void)clickBtnClick:(UIButton *)sender
{
if (self.block) {
self.block(YES);
}
[self dismissUI];
}
- (void)tapClick:(UITapGestureRecognizer *)tap {
[self dismissUI];
}
#pragma mark -隐藏弹框
- (void)dismissUI
{
[self removeFromSuperview];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// GuideMyWalletAlertView.h
// Open
//
// Created by 雷俊博 on 2021/8/19.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef void (^GuideMyWalletAlertViewClickBlock)(BOOL success);
@interface GuideMyWalletAlertView : UIView
+ (void)showWithImageName:(NSString *)imageName VC:(UIViewController *)vc Block:(GuideMyWalletAlertViewClickBlock)block;
@end
NS_ASSUME_NONNULL_END
//
// GuideMyWalletAlertView.m
// Open
//
// Created by 雷俊博 on 2021/8/19.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import "GuideMyWalletAlertView.h"
#import <MediaPlayer/MediaPlayer.h>
@interface GuideMyWalletAlertView ()<UIGestureRecognizerDelegate>
/** 弹窗主内容view */
@property (nonatomic,strong) UIView *contentView;
@property (nonatomic, copy)NSString *imageName;
@property (nonatomic, copy)GuideMyWalletAlertViewClickBlock block;
@property(nonatomic,strong) MPMoviePlayerController *movieController;//添加movieController的属性
@end
@implementation GuideMyWalletAlertView
- (instancetype)initWithImageName:(NSString *)imageName Block:(GuideMyWalletAlertViewClickBlock)block
{
self = [super init];
if (self) {
self.imageName = imageName;
self.block = block;
[self setupUI];
}
return self;
}
- (void)setupUI
{
self.frame = [UIScreen mainScreen].bounds;
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapClick:)];
tap.delegate = self;
[self addGestureRecognizer:tap];
//------- 弹窗主内容 -------//
self.contentView = [[UIView alloc] init];
self.contentView.frame = CGRectMake(0, 0, 320 * WIDTHRADIU, 350 * WIDTHRADIU);
self.contentView.center = self.center;
[self addSubview:self.contentView];
self.contentView.backgroundColor = [UIColor clearColor];
//背景图片
UIImageView *bgImg = [[UIImageView alloc]initWithFrame:self.contentView.bounds];
bgImg.image = [UIImage imageNamed:self.imageName];
[self.contentView addSubview:bgImg];
//title
NSUInteger r = arc4random_uniform(100) + 100;
UILabel *lb_title = [UILabel new];
lb_title.numberOfLines = 0;
[self.contentView addSubview:lb_title];
NSString *title = [NSString stringWithFormat:@"今日在线%ld个任务\n完成后预估收益",r];
lb_title.attributedText = [self getAttributedStringWithString:title lineSpace:8*WIDTHRADIU kern:0.5];
[lb_title mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.offset(22 * WIDTHRADIU);
make.left.offset(15 * WIDTHRADIU);
make.right.offset(- 15 * WIDTHRADIU);
}];
//lb_content
UILabel *lb_content = [UILabel new];
[self.contentView addSubview:lb_content];
NSDictionary *attributesExtra = @{NSFontAttributeName:[UIFont boldSystemFontOfSize:18 * WIDTHRADIU],//字号18
NSForegroundColorAttributeName: [UIColor colorWithHex:0xd63c2f]};
NSDictionary *attributesPrice = @{NSFontAttributeName:[UIFont boldSystemFontOfSize:60 * WIDTHRADIU],//字号60
NSForegroundColorAttributeName: [UIColor colorWithHex:0xd63c2f]};
NSString *num = [NSString stringWithFormat:@"%.2f",[self randomBetween:300.00 AndBigNum:500.00 AndPrecision:2]];
NSAttributedString *attributedString = [self attributedText:@[num, @"元"]
attributeAttay:@[attributesPrice,attributesExtra]];
lb_content.attributedText = attributedString;
[lb_content mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(lb_title.mas_bottom).offset(10 * WIDTHRADIU);
make.centerX.equalTo(lb_title);
}];
UIButton *clickBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[clickBtn addTarget:self action:@selector(clickBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:clickBtn];
[clickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.bottom.offset( - 15 * WIDTHRADIU);
make.width.offset(255 * WIDTHRADIU);
make.height.offset(44 * WIDTHRADIU);
}];
UIImageView *closeImg = [UIImageView new];
closeImg.image = [UIImage imageNamed:@"guide_close"];
[self addSubview:closeImg];
[closeImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.top.equalTo(self.contentView.mas_bottom).offset(30 * WIDTHRADIU);
make.width.height.offset(30 * WIDTHRADIU);
}];
}
#pragma mark - UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if ([touch.view isDescendantOfView:self.contentView]) {
return NO;
}
return YES;
}
+ (void)showWithImageName:(NSString *)imageName VC:(UIViewController *)vc Block:(GuideMyWalletAlertViewClickBlock)block
{
GuideMyWalletAlertView *alertView = [[GuideMyWalletAlertView alloc]initWithImageName:imageName Block:block];
[vc.view addSubview:alertView];
}
#pragma mark - event response
- (void)clickBtnClick:(UIButton *)sender
{
if (self.block) {
self.block(YES);
}
[self dismissUI];
}
- (void)tapClick:(UITapGestureRecognizer *)tap {
[self dismissUI];
}
#pragma mark -隐藏弹框
- (void)dismissUI
{
[self removeFromSuperview];
}
#pragma mark - 获取自定义行间隔富文本
- (NSAttributedString *)getAttributedStringWithString:(NSString *)text lineSpace:(CGFloat)lineSpace kern:(CGFloat)kern {
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
//调行行间距
paragraphStyle.lineSpacing = lineSpace;
paragraphStyle.alignment = NSTextAlignmentCenter;
NSDictionary*attriDict =@{NSParagraphStyleAttributeName:paragraphStyle,NSKernAttributeName:@(kern),NSFontAttributeName:[UIFont systemFontOfSize:18* WIDTHRADIU weight:UIFontWeightMedium],NSForegroundColorAttributeName:[UIColor colorWithHex:0xe85246]};
NSMutableAttributedString*attributedString = [[NSMutableAttributedString alloc]initWithString:text attributes:attriDict];
return attributedString;
}
- (NSAttributedString *)attributedText:(NSArray*)stringArray attributeAttay:(NSArray *)attributeAttay{
  // 定义要显示的文字内容
NSString * string = [stringArray componentsJoinedByString:@""];  //拼接传入的字符串数组
  // 通过要显示的文字内容来创建一个带属性样式的字符串对象
NSMutableAttributedString * result = [[NSMutableAttributedString alloc] initWithString:string];
for(NSInteger i = 0; i < stringArray.count; i++){
     // 将某一范围内的字符串设置样式
[result setAttributes:attributeAttay[i] range:[string rangeOfString:stringArray[i]]];
}
[result addAttribute:NSBaselineOffsetAttributeName value:@(2 * WIDTHRADIU) range:NSMakeRange(string.length - 1, 1)];
// 返回已经设置好了的带有样式的文字
return [[NSAttributedString alloc] initWithAttributedString:result];
}
/**
* samllNum: 两数中的最小值
* bigNum: 两数中的最大值
* precision: 精度值,如:精确1位小数,precision参数值为10; 两位小数precision参数值为100;
*/
- (float)randomBetween:(float)smallNum AndBigNum:(float)bigNum AndPrecision:(NSInteger)precision{
//求两数之间的差值
float subtraction = bigNum - smallNum;
//取绝对值
subtraction = ABS(subtraction);
//乘以精度的位数
subtraction *= precision;
//在差值间随机
float randomNumber = arc4random() % ((int) subtraction + 1);
//随机的结果除以精度的位数
randomNumber /= precision;
//将随机的值加到较小的值上
float result = MIN(smallNum, bigNum) + randomNumber;
//返回结果
return result;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// GuideONLineFindJobAlertView.h
// Open
//
// Created by 雷俊博 on 2021/8/5.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef void (^GuideONLineFindJobAlertViewClickBlock)(BOOL success);
@interface GuideONLineFindJobAlertView : UIView
+ (void)showWithVC:(UIViewController *)vc Block:(GuideONLineFindJobAlertViewClickBlock)block;
@end
NS_ASSUME_NONNULL_END
//
// GuideONLineFindJobAlertView.m
// Open
//
// Created by 雷俊博 on 2021/8/5.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import "GuideONLineFindJobAlertView.h"
@interface GuideONLineFindJobAlertView ()<UIGestureRecognizerDelegate>
/** 弹窗主内容view */
@property (nonatomic,strong) UIView *contentView;
@property (nonatomic, copy)GuideONLineFindJobAlertViewClickBlock block;
@end
@implementation GuideONLineFindJobAlertView
- (instancetype)initWithBlock:(GuideONLineFindJobAlertViewClickBlock)block
{
self = [super init];
if (self) {
self.block = block;
[self setupUI];
}
return self;
}
- (void)setupUI
{
self.frame = [UIScreen mainScreen].bounds;
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapClick:)];
tap.delegate = self;
[self addGestureRecognizer:tap];
//------- 弹窗主内容 -------//
self.contentView = [[UIView alloc] init];
self.contentView.frame = CGRectMake(0, 0, 315 * WIDTHRADIU, 350 * WIDTHRADIU);
self.contentView.center = self.center;
[self addSubview:self.contentView];
self.contentView.backgroundColor = [UIColor clearColor];
//背景图片
UIImageView *bgImg = [[UIImageView alloc]initWithFrame:self.contentView.bounds];
bgImg.image = [UIImage imageNamed:@"guide_oneline"];
[self.contentView addSubview:bgImg];
//开启图片
UIImageView *openImg = [UIImageView new];
openImg.image = [UIImage imageNamed:@"guide_open"];
[self.contentView addSubview:openImg];
[openImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.offset(-25 * WIDTHRADIU);
make.centerX.equalTo(self.contentView);
make.width.offset(121 * WIDTHRADIU);
make.height.offset(125 * WIDTHRADIU);
}];
CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@"transform.scale"];
animation.fromValue=[NSNumber numberWithFloat:0.9];
animation.toValue=[NSNumber numberWithFloat:1.1];
animation.duration=0.5;
animation.autoreverses=YES;
animation.repeatCount=HUGE_VALF;
animation.removedOnCompletion=NO;
animation.fillMode=kCAFillModeForwards;
[openImg.layer addAnimation:animation forKey:@"zoom"];
UIImageView *img_hand = [[UIImageView alloc]init];
img_hand.image = [UIImage imageNamed:@"guide_hand"];
[self.contentView addSubview:img_hand];
[img_hand mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(openImg.mas_right).offset(-25 * WIDTHRADIU);
make.bottom.offset(-30 * WIDTHRADIU);
make.width.offset(57 * WIDTHRADIU);
make.height.offset(54 * WIDTHRADIU);
}];
CABasicAnimation *animation2=[CABasicAnimation animationWithKeyPath:@"transform.scale"];
animation.fromValue=[NSNumber numberWithFloat:0.9];
animation2.toValue=[NSNumber numberWithFloat:1.1];
animation2.duration=0.5;
animation2.autoreverses=YES;
animation2.repeatCount=HUGE_VALF;
animation2.removedOnCompletion=NO;
animation2.fillMode=kCAFillModeForwards;
[img_hand.layer addAnimation:animation2 forKey:@"zoom"];
UIButton *clickBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[clickBtn addTarget:self action:@selector(clickBtnClick:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:clickBtn];
[clickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.height.width.equalTo(openImg);
}];
UIImageView *closeImg = [UIImageView new];
closeImg.image = [UIImage imageNamed:@"guide_close"];
[self addSubview:closeImg];
[closeImg mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.contentView);
make.top.equalTo(self.contentView.mas_bottom).offset(30 * WIDTHRADIU);
make.width.height.offset(30 * WIDTHRADIU);
}];
}
#pragma mark - UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if ([touch.view isDescendantOfView:self.contentView]) {
return NO;
}
return YES;
}
+ (void)showWithVC:(UIViewController *)vc Block:(GuideONLineFindJobAlertViewClickBlock)block
{
GuideONLineFindJobAlertView *alertView = [[GuideONLineFindJobAlertView alloc]initWithBlock:block];
[vc.view addSubview:alertView];
}
#pragma mark - event response
- (void)clickBtnClick:(UIButton *)sender
{
if (self.block) {
self.block(YES);
}
[self dismissUI];
}
- (void)tapClick:(UITapGestureRecognizer *)tap {
[self dismissUI];
}
#pragma mark -隐藏弹框
- (void)dismissUI
{
[self removeFromSuperview];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// KSBulletScreenManager.h
// KSAdSDKGitDemo
//
// Created by xuzhijun on 2019/12/27.
// Copyright © 2019 xuzhijun. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface KSBulletScreenManager : NSObject
- (void)showWithText:(NSString *)text;
#pragma mark - Singleton
+ (instancetype)sharedInstance;
@end
NS_ASSUME_NONNULL_END
//
// KSBulletScreenManager.m
// KSAdSDKGitDemo
//
// Created by xuzhijun on 2019/12/27.
// Copyright © 2019 xuzhijun. All rights reserved.
//
#import "KSBulletScreenManager.h"
#import <UIKit/UIKit.h>
#import <Masonry/Masonry.h>
#import "KSBulletScreenModel.h"
@interface KSBulletScreenManager ()
@property (nonatomic, strong) UIView *contentView;
@property (nonatomic, strong) NSMutableArray *textArray;
@property (nonatomic, strong) NSMutableArray *showedTextArray;
@property (nonatomic, strong) NSLock *lock;
@property (nonatomic, assign) BOOL haveInstalled;
@property (nonatomic, assign) NSInteger index;
@end
@implementation KSBulletScreenManager
+ (void)install {
KSBulletScreenManager *manager = [KSBulletScreenManager sharedInstance];
if (manager.haveInstalled) {
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication].keyWindow addSubview:manager.contentView];
manager.haveInstalled = YES;
[manager.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(@0);
make.top.equalTo(@64);
make.height.equalTo(manager.contentView.superview.mas_height).multipliedBy(0.3);
}];
});
}
- (void)show {
}
- (UILabel *)labelWithText:(NSString *)text {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 14)];
label.text = text;
label.layer.borderColor = [UIColor greenColor].CGColor;
label.textColor = [UIColor blueColor];
label.layer.borderWidth = 0.5;
return label;
}
- (void)showWithText:(NSString *)text {
if (text.length == 0) {
return;
}
[KSBulletScreenManager install];
__weak typeof(self) weakSelf = self;
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[weakSelf _showWithText:text];
}];
}
- (void)_showWithText:(NSString *)text {
[self.contentView.superview bringSubviewToFront:self.contentView];
UILabel *label = [self labelWithText:text];
[label sizeToFit];
CGFloat labelHeight = label.frame.size.height;
[self.contentView addSubview:label];
__block MASConstraint *leftConstraint = nil;
CGFloat width = [UIApplication sharedApplication].keyWindow.bounds.size.width;
NSInteger currentIndex = [self currentIndex];
[label mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(@(currentIndex * (labelHeight + 5)));
make.height.equalTo(@(labelHeight));
leftConstraint = make.left.equalTo(@(width));
}];
[self.contentView layoutIfNeeded];
[self increamIndex];
[UIView animateWithDuration:4 animations:^{
// 设置动画约束
leftConstraint.equalTo(@(-300)); // 总共的位移距离是一样的,那么速度就是一样的
[self.contentView layoutIfNeeded];
} completion:^(BOOL finished) {
[label removeFromSuperview];
[self decreamIndex];
}];
}
- (void)increamIndex {
[self.lock lock];
self.index++;
[self.lock unlock];
}
- (void)decreamIndex {
[self.lock lock];
self.index--;
[self.lock unlock];
}
- (NSInteger)currentIndex {
NSInteger resultIndex = 0;
[self.lock lock];
resultIndex = self.index;
[self.lock unlock];
return resultIndex;
}
- (void)addBulletScreenModel:(KSBulletScreenModel *)model {
[self.lock lock];
[self.textArray addObject:model];
[self.lock unlock];
}
- (void)removeBulletScreenModel:(KSBulletScreenModel *)model {
[self.lock lock];
[self.textArray removeObject:model];
[self.lock unlock];
}
#pragma mark - Singleton
- (instancetype)init {
if (self = [super init]) {
self.textArray = [NSMutableArray new];
self.showedTextArray = [NSMutableArray new];
self.contentView = [UIView new];
self.contentView.userInteractionEnabled = NO;
self.lock = [NSLock new];
}
return self;
}
+ (instancetype)sharedInstance {
static id sharedInstance = nil;
static dispatch_once_t predicate;
dispatch_once(&predicate, ^{
sharedInstance = [[self alloc] init];
});
return sharedInstance;
}
@end
//
// KSBulletScreenModel.h
// KSAdSDKGitDemo
//
// Created by xuzhijun on 2019/12/27.
// Copyright © 2019 xuzhijun. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface KSBulletScreenModel : NSObject
@property (nonatomic, copy) NSString *contentText;
@end
NS_ASSUME_NONNULL_END
//
// KSBulletScreenModel.m
// KSAdSDKGitDemo
//
// Created by xuzhijun on 2019/12/27.
// Copyright © 2019 xuzhijun. All rights reserved.
//
#import "KSBulletScreenModel.h"
@implementation KSBulletScreenModel
@end
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
//
// TVDemo.swift
// Open
//
// Created by 雷俊博 on 2021/2/19.
// Copyright © 2021 黄江涛 . All rights reserved.
//
import Foundation
//
// TimerProxy.h
// Open
//
// Created by 雷俊博 on 2021/7/21.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface TimerProxy : NSProxy
- (instancetype)initWithTarget:(id)target;
@end
NS_ASSUME_NONNULL_END
//
// TimerProxy.m
// Open
//
// Created by 雷俊博 on 2021/7/21.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import "TimerProxy.h"
@interface TimerProxy ()
@property (nonatomic,weak)id target;
@end
@implementation TimerProxy
- (instancetype)initWithTarget:(id)target {
self.target = target;
return self;
}
/*
这个函数让重载方有机会抛出一个函数的签名,再由后面的forwardInvocation:去执行
*/
- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel {
return [self.target methodSignatureForSelector:sel];
}
/*
将消息转发给其他对象,这里转发给控制器
*/
- (void)forwardInvocation:(NSInvocation *)invocation {
SEL sel=[invocation selector];
if ([self.target respondsToSelector:sel]) {
[invocation invokeWithTarget:self.target];
}
}
@end
//
// KKTooltipView.h
// Open
//
// Created by 雷俊博 on 2021/4/7.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
#pragma mark - KKTooltipViewArrowDirection
typedef NS_ENUM(NSInteger, KKTooltipViewArrowDirection) {
KKTooltipViewArrowDirectionUp,
KKTooltipViewArrowDirectionRight,
KKTooltipViewArrowDirectionDown,
KKTooltipViewArrowDirectionLeft
};
#pragma mark - KKTooltipViewCompletionBlock
typedef void (^KKTooltipViewCompletionBlock)(void);
@interface KKTooltipView : UIView
#pragma mark Tooltip Text
/**
* The text that is displayed in the tooltip.
*/
@property (nonatomic, copy) NSString *tooltipText;
/**
* The colour of the tooltip text. Default is @c white.
*/
@property (nonatomic, strong) UIColor *textColour;
/**
* The alignment of the tooltip text. Default is NSTextAlignmentCenter.
*/
@property (nonatomic) NSTextAlignment textAlignment;
/**
* The line break mode of the tooltip text. Default is NSLineBreakByTruncatingTail.
*/
@property (nonatomic) NSLineBreakMode lineBreakMode;
/**
* The number of lines of the tooltip text. Default is 0 (no limit).
*/
@property (nonatomic) NSInteger numberOfLines;
/**
* The font for the text shown in the tooltip.
*/
@property (nonatomic, strong) UIFont *font;
@end
NS_ASSUME_NONNULL_END
//
// KKTooltipView.m
// Open
//
// Created by 雷俊博 on 2021/4/7.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import "KKTooltipView.h"
@implementation KKTooltipView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
//
// KKTooltips.h
// Open
//
// Created by 雷俊博 on 2021/4/7.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#ifndef KKTooltips_h
#define KKTooltips_h
#endif /* KKTooltips_h */
//
// KKEncapsulationManager.h
// Open
//
// Created by 雷俊博 on 2021/7/29.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface KKEncapsulationManager : NSObject
@end
NS_ASSUME_NONNULL_END
//
// KKEncapsulationManager.m
// Open
//
// Created by 雷俊博 on 2021/7/29.
// Copyright © 2021 黄江涛 . All rights reserved.
//
#import "KKEncapsulationManager.h"
@implementation KKEncapsulationManager
@end
/*
File: KeychainItemWrapper.h
Abstract:
Objective-C wrapper for accessing a single keychain item.
Version: 1.2
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2010 Apple Inc. All Rights Reserved.
*/
#import <UIKit/UIKit.h>
/*
The KeychainItemWrapper class is an abstraction layer for the iPhone Keychain communication. It is merely a
simple wrapper to provide a distinct barrier between all the idiosyncracies involved with the Keychain
CF/NS container objects.
*/
@interface KeychainItemWrapper : NSObject
{
NSMutableDictionary *keychainItemData; // The actual keychain item data backing store.
NSMutableDictionary *genericPasswordQuery; // A placeholder for the generic keychain item query used to locate the item.
NSString* _identifier;
}
@property (nonatomic, strong) NSMutableDictionary *keychainItemData;
@property (nonatomic, strong) NSMutableDictionary *genericPasswordQuery;
// Designated initializer.
- (id)initWithIdentifier: (NSString *)identifier accessGroup:(NSString *) accessGroup;
- (void)setObject:(id)inObject forKey:(id)key;
- (id)objectForKey:(id)key;
// Initializes and resets the default generic keychain item data.
- (void)resetKeychainItem;
@end
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
//
// SSKeychain.m
// SSToolkit
//
// Created by Sam Soffes on 5/19/10.
// Copyright (c) 2009-2011 Sam Soffes. All rights reserved.
//
#import "SSKeychain.h"
NSString *const kSSKeychainErrorDomain = @"com.samsoffes.sskeychain";
NSString *const kSSKeychainAccountKey = @"acct";
NSString *const kSSKeychainCreatedAtKey = @"cdat";
NSString *const kSSKeychainClassKey = @"labl";
NSString *const kSSKeychainDescriptionKey = @"desc";
NSString *const kSSKeychainLabelKey = @"labl";
NSString *const kSSKeychainLastModifiedKey = @"mdat";
NSString *const kSSKeychainWhereKey = @"svce";
#if __IPHONE_4_0 && TARGET_OS_IPHONE
CFTypeRef SSKeychainAccessibilityType = NULL;
#endif
@interface SSKeychain ()
+ (NSMutableDictionary *)_queryForService:(NSString *)service account:(NSString *)account;
@end
@implementation SSKeychain
#pragma mark - Getting Accounts
+ (NSArray *)allAccounts {
return [self accountsForService:nil error:nil];
}
+ (NSArray *)allAccounts:(NSError **)error {
return [self accountsForService:nil error:error];
}
+ (NSArray *)accountsForService:(NSString *)service {
return [self accountsForService:service error:nil];
}
+ (NSArray *)accountsForService:(NSString *)service error:(NSError **)error {
OSStatus status = SSKeychainErrorBadArguments;
NSMutableDictionary *query = [self _queryForService:service account:nil];
#if __has_feature(objc_arc)
[query setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnAttributes];
[query setObject:(__bridge id)kSecMatchLimitAll forKey:(__bridge id)kSecMatchLimit];
#else
[query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnAttributes];
[query setObject:(id)kSecMatchLimitAll forKey:(id)kSecMatchLimit];
#endif
CFTypeRef result = NULL;
#if __has_feature(objc_arc)
status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
#else
status = SecItemCopyMatching((CFDictionaryRef)query, &result);
#endif
if (status != noErr && error != NULL) {
*error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
return nil;
}
#if __has_feature(objc_arc)
return (__bridge_transfer NSArray *)result;
#else
return [(NSArray *)result autorelease];
#endif
}
#pragma mark - Getting Passwords
+ (NSString *)passwordForService:(NSString *)service account:(NSString *)account {
return [self passwordForService:service account:account error:nil];
}
+ (NSString *)passwordForService:(NSString *)service account:(NSString *)account error:(NSError **)error {
NSData *data = [self passwordDataForService:service account:account error:error];
if (data.length > 0) {
NSString *string = [[NSString alloc] initWithData:(NSData *)data encoding:NSUTF8StringEncoding];
#if !__has_feature(objc_arc)
[string autorelease];
#endif
return string;
}
return nil;
}
+ (NSData *)passwordDataForService:(NSString *)service account:(NSString *)account {
return [self passwordDataForService:service account:account error:nil];
}
+ (NSData *)passwordDataForService:(NSString *)service account:(NSString *)account error:(NSError **)error {
OSStatus status = SSKeychainErrorBadArguments;
if (!service || !account) {
if (error) {
*error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
}
return nil;
}
CFTypeRef result = NULL;
NSMutableDictionary *query = [self _queryForService:service account:account];
#if __has_feature(objc_arc)
[query setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnData];
[query setObject:(__bridge id)kSecMatchLimitOne forKey:(__bridge id)kSecMatchLimit];
status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
#else
[query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnData];
[query setObject:(id)kSecMatchLimitOne forKey:(id)kSecMatchLimit];
status = SecItemCopyMatching((CFDictionaryRef)query, &result);
#endif
if (status != noErr && error != NULL) {
*error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
return nil;
}
#if __has_feature(objc_arc)
return (__bridge_transfer NSData *)result;
#else
return [(NSData *)result autorelease];
#endif
}
#pragma mark - Deleting Passwords
+ (BOOL)deletePasswordForService:(NSString *)service account:(NSString *)account {
return [self deletePasswordForService:service account:account error:nil];
}
+ (BOOL)deletePasswordForService:(NSString *)service account:(NSString *)account error:(NSError **)error {
OSStatus status = SSKeychainErrorBadArguments;
if (service && account) {
NSMutableDictionary *query = [self _queryForService:service account:account];
#if __has_feature(objc_arc)
status = SecItemDelete((__bridge CFDictionaryRef)query);
#else
status = SecItemDelete((CFDictionaryRef)query);
#endif
}
if (status != noErr && error != NULL) {
*error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
}
return (status == noErr);
}
#pragma mark - Setting Passwords
+ (BOOL)setPassword:(NSString *)password forService:(NSString *)service account:(NSString *)account {
return [self setPassword:password forService:service account:account error:nil];
}
+ (BOOL)setPassword:(NSString *)password forService:(NSString *)service account:(NSString *)account error:(NSError **)error {
NSData *data = [password dataUsingEncoding:NSUTF8StringEncoding];
return [self setPasswordData:data forService:service account:account error:error];
}
+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)service account:(NSString *)account {
return [self setPasswordData:password forService:service account:account error:nil];
}
+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)service account:(NSString *)account error:(NSError **)error {
OSStatus status = SSKeychainErrorBadArguments;
if (password && service && account) {
[self deletePasswordForService:service account:account];
NSMutableDictionary *query = [self _queryForService:service account:account];
#if __has_feature(objc_arc)
[query setObject:password forKey:(__bridge id)kSecValueData];
#else
[query setObject:password forKey:(id)kSecValueData];
#endif
#if __IPHONE_4_0 && TARGET_OS_IPHONE
if (SSKeychainAccessibilityType) {
#if __has_feature(objc_arc)
[query setObject:(id)[self accessibilityType] forKey:(__bridge id)kSecAttrAccessible];
#else
[query setObject:(id)[self accessibilityType] forKey:(id)kSecAttrAccessible];
#endif
}
#endif
#if __has_feature(objc_arc)
status = SecItemAdd((__bridge CFDictionaryRef)query, NULL);
#else
status = SecItemAdd((CFDictionaryRef)query, NULL);
#endif
}
if (status != noErr && error != NULL) {
*error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
}
return (status == noErr);
}
#pragma mark - Configuration
#if __IPHONE_4_0 && TARGET_OS_IPHONE
+ (CFTypeRef)accessibilityType {
return SSKeychainAccessibilityType;
}
+ (void)setAccessibilityType:(CFTypeRef)accessibilityType {
CFRetain(accessibilityType);
if (SSKeychainAccessibilityType) {
CFRelease(SSKeychainAccessibilityType);
}
SSKeychainAccessibilityType = accessibilityType;
}
#endif
#pragma mark - Private
+ (NSMutableDictionary *)_queryForService:(NSString *)service account:(NSString *)account {
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:3];
#if __has_feature(objc_arc)
[dictionary setObject:(__bridge id)kSecClassGenericPassword forKey:(__bridge id)kSecClass];
#else
[dictionary setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];
#endif
if (service) {
#if __has_feature(objc_arc)
[dictionary setObject:service forKey:(__bridge id)kSecAttrService];
#else
[dictionary setObject:service forKey:(id)kSecAttrService];
#endif
}
if (account) {
#if __has_feature(objc_arc)
[dictionary setObject:account forKey:(__bridge id)kSecAttrAccount];
#else
[dictionary setObject:account forKey:(id)kSecAttrAccount];
#endif
}
return dictionary;
}
@end
//
// CYRKeyboardButton.h
//
// Created by Illya Busigin on 7/19/14.
// Copyright (c) 2014 Cyrillian, Inc.
// Portions Copyright (c) 2013 Nigel Timothy Barber (TurtleBezierPath)
//
// Distributed under MIT license.
// Get the latest version from here:
//
// https://github.com/illyabusigin/CYRKeyboardButton
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Cyrillian, Inc.
//
// 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.
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSUInteger, CYRKeyboardButtonPosition) {
CYRKeyboardButtonPositionLeft,
CYRKeyboardButtonPositionInner,
CYRKeyboardButtonPositionRight,
CYRKeyboardButtonPositionCount
};
/**
The style of the keyboard button. You use these constants to set the value of the keyboard button style.
*/
typedef NS_ENUM(NSUInteger, CYRKeyboardButtonStyle) {
/** Keyboard buttons are styled like iPhone keyboard buttons. */
CYRKeyboardButtonStylePhone,
/** Keyboard buttons are styled like iPad keyboard buttons. */
CYRKeyboardButtonStyleTablet
};
/**
Notifies observers that the keyboard button has been pressed. The affected button is stored in the object parameter of the notification. The userInfo dictionary contains the pressed key and can be accessed with the CYRKeyboardButtonKeyPressedKey key.
*/
extern NSString *const CYRKeyboardButtonPressedNotification;
/**
Notifies observers that the keyboard button has show the expanded input view. The affected button is stored in the object parameter of the notification.
*/
extern NSString *const CYRKeyboardButtonDidShowExpandedInputNotification;
/**
Notifies observers that the keyboard button has hidden the expanded input view. The affected button is stored in the object parameter of the notification.
*/
extern NSString *const CYRKeyboardButtonDidHideExpandedInputNotification;
/**
The key used to fetch the pressed key string from the userInfo dictionary returned when CYRKeyboardButtonPressedNotification is fired.
*/
extern NSString *const CYRKeyboardButtonKeyPressedKey;
/**
CYRKeyboardButton is a drop-in keyboard button that mimics the look, feel, and functionality of the native iOS keyboard buttons. This button is highly configurable via a variety of styling properties which conform to the UIAppearance protocol.
*/
@interface CYRKeyboardButton : UIButton
/**
The style of the keyboard button. This determines the basic visual appearance of the keyboard.
@discussion The style value is automatically determined during initialization but can be overriden.
*/
@property (nonatomic, assign) CYRKeyboardButtonStyle style;
// Styling
/**
The font associated with the keyboard button.
@discussion This font only affects the keyboard button's standard view.
*/
@property (nonatomic, strong) UIFont *dFont UI_APPEARANCE_SELECTOR;
/**
The font associated with the keyboard button input options.
*/
@property (nonatomic, strong) UIFont *inputOptionsFont UI_APPEARANCE_SELECTOR;
/**
The default color of the keyboard button.
*/
@property (nonatomic, strong) UIColor *keyColor UI_APPEARANCE_SELECTOR;
/**
The text color of the keyboard button.
@discussion This color affects both the standard and input option text.
*/
@property (nonatomic, strong) UIColor *keyTextColor UI_APPEARANCE_SELECTOR;
/**
The shadow color for the keyboard button.
*/
@property (nonatomic, strong) UIColor *keyShadowColor UI_APPEARANCE_SELECTOR;
/**
The highlighted background color of the keyboard button.
*/
@property (nonatomic, strong) UIColor *keyHighlightedColor UI_APPEARANCE_SELECTOR;
/**
The position of the keyboard button. This is used to determine where to place the popover key views and is automatically determined when the keyboard button is added to a view and update during layout changes.
*/
@property (nonatomic, readonly) CYRKeyboardButtonPosition position;
// Configuration
/**
The string input for the keyboard button. This is the string that would be inserted upon a successful key press.
*/
@property (nonatomic, strong) NSString *input;
/**
An array of input option strings associated with the keybonard button. The user must tap and hold the keyboard button for 0.3 seconds before the input options will be displayed.
@discussion Input options are automatically positioned based on the keyboard buttons position within its' superview.
*/
@property (nonatomic, strong) NSArray *inputOptions;
/**
An object that adopts the UITextInput protocol. When a key is pressed the key value is automatically inserted via the textInput object.
@discussion If the textInput object is not the first responder no text will be inserted.
*/
@property (nonatomic, weak) id<UITextInput> textInput;
@end
//
// CYRKeyboardButtonView.h
//
// Created by Illya Busigin on 7/19/14.
// Copyright (c) 2014 Cyrillian, Inc.
// Portions Copyright (c) 2013 Nigel Timothy Barber (TurtleBezierPath)
//
// Distributed under MIT license.
// Get the latest version from here:
//
// https://github.com/illyabusigin/CYRKeyboardButton
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Cyrillian, Inc.
//
// 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.
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSUInteger, CYRKeyboardButtonViewType) {
CYRKeyboardButtonViewTypeInput,
CYRKeyboardButtonViewTypeExpanded
};
@class CYRKeyboardButton;
@interface CYRKeyboardButtonView : UIView
@property (nonatomic, readonly) CYRKeyboardButtonViewType type;
@property (nonatomic, readonly) NSInteger selectedInputIndex;
- (instancetype)initWithKeyboardButton:(CYRKeyboardButton *)button type:(CYRKeyboardButtonViewType)type;
- (void)updateSelectedInputIndexForPoint:(CGPoint)point;
@end
//
// TurtleBezierPath.h
// TurtleBezierPath demo
//
// Created by Nigel Barber on 09/12/2013.
// Copyright (c) 2013 Nigel Barber. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TurtleBezierPath : UIBezierPath
@property( nonatomic, assign ) CGFloat bearing;
@property( nonatomic, assign ) BOOL penUp;
-(CGRect)boundsWithStroke;
-(CGRect)boundsForView;
-(void)home;
-(void)forward:(CGFloat)distance;
-(void)turn:(CGFloat)angle;
-(void)leftArc:(CGFloat)radius turn:(CGFloat)angle;
-(void)rightArc:(CGFloat)radius turn:(CGFloat)angle;
-(void)down;
-(void)up;
-(void)centreInBounds:(CGRect)bounds;
@end
//
// TurtleBezierPath.m
// TurtleBezierPath demo
//
// Created by Nigel Barber on 09/12/2013.
// Copyright (c) 2013 Nigel Barber. All rights reserved.
//
#import "TurtleBezierPath.h"
@implementation TurtleBezierPath
#pragma mark - NSCoding
-(void)encodeWithCoder:(NSCoder *)aCoder
{
[ super encodeWithCoder:aCoder ];
[ aCoder encodeFloat:self.bearing forKey:@"bearing" ];
[ aCoder encodeBool:self.penUp forKey:@"penUp" ];
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
if( self = [ super initWithCoder:aDecoder ])
{
self.bearing = [ aDecoder decodeFloatForKey:@"bearing" ];
self.penUp = [ aDecoder decodeBoolForKey:@"penUp" ];
}
return self;
}
#pragma mark - NSCopying
-(id)copyWithZone:(NSZone *)zone
{
TurtleBezierPath *clone = [[ TurtleBezierPath allocWithZone:zone ] init ];
clone.CGPath = self.CGPath;
clone.lineCapStyle = self.lineCapStyle;
clone.lineJoinStyle = self.lineJoinStyle;
clone.lineWidth = self.lineWidth;
clone.miterLimit = self.miterLimit;
clone.flatness = self.flatness;
clone.usesEvenOddFillRule = self.usesEvenOddFillRule;
CGFloat phase;
NSInteger count;
[ self getLineDash:nil count:&count phase:&phase ];
CGFloat *lineDash = malloc( count * sizeof( CGFloat ));
[ self getLineDash:lineDash count:&count phase:&phase ];
[ clone setLineDash:lineDash count:count phase:phase ];
free( lineDash );
clone.bearing = self.bearing;
clone.penUp = self.penUp;
return clone;
}
#pragma mark - Private methods
-(void)arc:(CGFloat)radius turn:(CGFloat)angle clockwise:(BOOL)clockwise
{
CGFloat radiusTurn = ( clockwise ) ? 90.0f : -90.0f;
CGFloat cgAngleBias = ( clockwise ) ? 180.0f : 0.0f;
angle = ( clockwise ) ? angle : -angle;
CGPoint centre = [ self toCartesian:radius bearing:self.bearing + radiusTurn origin:self.currentPoint ];
CGFloat cgStartAngle = cgAngleBias + self.bearing;
CGFloat cgEndAngle = cgAngleBias + ( self.bearing + angle );
self.bearing += angle;
CGPoint endPoint = [ self toCartesian:radius bearing:( self.bearing -radiusTurn ) origin:centre ];
if( self.penUp )
{
[ self moveToPoint:endPoint ];
}
else
{
[ self addArcWithCenter:centre radius:radius startAngle:radians( cgStartAngle ) endAngle:radians( cgEndAngle ) clockwise:clockwise ];
}
}
#pragma mark - Public methods
-(CGRect)boundsWithStroke
{
return CGRectIntegral( CGRectInset( self.bounds, -self.lineWidth * 0.5f, -self.lineWidth * 0.5f ));
}
-(CGRect)boundsForView
{
CGRect bounds = self.boundsWithStroke;
CGFloat maxWidth = MAX( fabs( CGRectGetMinX( bounds )), fabs( CGRectGetMaxX( bounds )));
CGFloat maxHeight = MAX( fabs( CGRectGetMinY( bounds )), fabs( CGRectGetMaxY( bounds )));
return CGRectMake( 0.0f, 0.0f, maxWidth * 2.0f, maxHeight * 2.0f );
}
-(BOOL)isEqual:(TurtleBezierPath *)aPath
{
return [[ NSKeyedArchiver archivedDataWithRootObject:self ] isEqualToData:[ NSKeyedArchiver archivedDataWithRootObject:aPath ]];
}
-(void)home
{
[ self moveToPoint:CGPointZero ];
self.bearing = 0.0f;
}
-(void)forward:(CGFloat)distance
{
CGPoint endPoint = [ self toCartesian:distance bearing:self.bearing origin:self.currentPoint ];
if( self.penUp )
{
[ self moveToPoint:endPoint ];
}
else
{
[ self addLineToPoint:endPoint ];
}
}
-(void)turn:(CGFloat)angle
{
self.bearing += angle;
}
-(void)leftArc:(CGFloat)radius turn:(CGFloat)angle
{
[ self arc:radius turn:angle clockwise:NO ];
}
-(void)rightArc:(CGFloat)radius turn:(CGFloat)angle
{
[ self arc:radius turn:angle clockwise:YES ];
}
-(void)down
{
self.penUp = NO;
}
-(void)up
{
self.penUp = YES;
}
-(void)centreInBounds:(CGRect)bounds
{
[ self applyTransform:CGAffineTransformMakeTranslation( bounds.size.width / 2.0f, bounds.size.height / 2.0f )];
}
#pragma mark - Maths
static inline CGFloat radians (CGFloat degrees) {return degrees * M_PI / 180.0;}
-(CGPoint)toCartesian:(CGFloat)radius bearing:(CGFloat)bearing origin:(CGPoint)origin
{
CGFloat bearingInRadians = radians( bearing );
CGPoint vector = CGPointMake( radius * sinf( bearingInRadians ), -radius * cosf( bearingInRadians ));
return CGPointMake( origin.x + vector.x, origin.y + vector.y );
}
@end
//
// KKIDKeyboardView.h
// Open
//
// Created by 雷俊博 on 2020/12/23.
// Copyright © 2020 黄江涛 . All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void(^KKIDKeyboardBtnClickBlock)(UIButton*button);
NS_ASSUME_NONNULL_BEGIN
@class KKIDKeyboardView;
@protocol KKIDKeyboardViewDelegate <NSObject>
-(void)clickKeyboardButton:(UIButton*)button;
@end
@interface KKIDKeyboardView : UIView
/**键盘按钮点击block*/
@property(nonatomic,copy) KKIDKeyboardBtnClickBlock clickBlock;
/**键盘按钮点击代理*/
@property (nonatomic,weak) id <KKIDKeyboardViewDelegate>delegate;
@property (weak, nonatomic) IBOutlet UIView *inputView;
/**通过xib方式加载View*/
+(instancetype)loadKeyboardFromNib;
@end
NS_ASSUME_NONNULL_END
//
// KKIDKeyboardView.m
// Open
//
// Created by 雷俊博 on 2020/12/23.
// Copyright © 2020 黄江涛 . All rights reserved.
//
#import "KKIDKeyboardView.h"
@implementation KKIDKeyboardView
-(void)awakeFromNib{
[super awakeFromNib];
//2,数字键盘随机数
[self generateRandomNumber];
[self setupButtonClickWithView:self.inputView];
}
//设置键盘View上的按钮点击方法
-(void)setupButtonClickWithView:(UIView*)view {
[view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[UIButton class]]) {
UIButton *button=(UIButton*)obj;
[button addTarget:self action:@selector(keyboardBtnClick:) forControlEvents:UIControlEventTouchUpInside];
}
}];
}
//键盘按钮点击事件
-(void)keyboardBtnClick:(UIButton*)button{
//1,使用代理
if ([self.delegate respondsToSelector:@selector(clickKeyboardButton:)]) {
[self.delegate clickKeyboardButton:button];
}
//2,使用Block
// if (self.clickBlock) {
// self.clickBlock(button);
// }
}
//数字键盘产生随机数
-(void)generateRandomNumber{
NSArray *randomArr=[self randomData];
__block NSInteger index=0;
[self.inputView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
UIButton *button=(UIButton*)obj;
if (button.tag!= 103) {
NSString* number = [NSString stringWithFormat:@"%@",randomArr[index++]];
[button setTitle:number forState:UIControlStateNormal];
}
}];
}
//直接产生0-9随机数
-(NSArray*)randomData{
NSMutableArray *numberArr=[NSMutableArray arrayWithArray:@[@1,@2,@3,@4,@5,@6,@7,@8,@9,@0,@"X"]];
NSInteger numberCount=numberArr.count;
NSMutableArray *tmpArr=[NSMutableArray array];
for (NSInteger i=0; i<numberCount; i++) {
NSNumber *number=numberArr[arc4random() % numberArr.count];
[tmpArr addObject:number];
[numberArr removeObject:number];
}
return tmpArr;
}
+(instancetype)loadKeyboardFromNib{
return [[[NSBundle mainBundle]loadNibNamed:@"KKIDKeyboardView" owner:self options:nil]lastObject];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
This diff is collapsed.
//
// LDDKeyboardView.h
// ICBCKeyboard
//
// Created by Ringo on 2017/5/12.
// Copyright © 2017年 Ringo. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef void(^LDDKeyboardBtnClickBlock)(UIButton*button);
typedef NS_ENUM(NSUInteger,LDDButtonType) {
LDDButtonTypeNumber=100, //数字键盘类型按钮
LDDButtonTypeChar, //字符键盘类型按钮
LDDButtonTypeSign, //符合键盘类型按钮
LDDButtonTypeDelete, //删除按钮
LDDButtonTypeLogin, //登录按钮
LDDButtonTypeShift, //大小写切换按钮
LDDButtonTypeSpace, //空格按钮
};
@class LDDKeyboardView;
@protocol LDDKeyboardViewDelegate <NSObject>
-(void)clickKeyboardButton:(UIButton*)button;
@end
@interface LDDKeyboardView : UIView
/**键盘按钮点击block*/
@property(nonatomic,copy) LDDKeyboardBtnClickBlock clickBlock;
/**键盘按钮点击代理*/
@property (nonatomic,weak) id <LDDKeyboardViewDelegate>delegate;
/**inputAccessoryView*/
@property (weak, nonatomic) IBOutlet UIView *accessoryView;
@property (nonatomic, strong) UIToolbar *customAccessoryView;
/**inputView*/
@property (weak, nonatomic) IBOutlet UIView *inputView;
/**字符键盘*/
@property (weak, nonatomic) IBOutlet UIView *charView;
@property (nonatomic, strong) UIView *inputTFView;
/**当前选中按钮*/
@property(nonatomic,strong) UIButton *selectedBtn;
/**字符键盘左边约束*/
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *leftConstraint;
-(void)changeToCharModelKeyBoard;
-(void)changeToNumModelKeyBoard;
-(void)lowercaseString;
/**通过xib方式加载View*/
+(instancetype)loadKeyboardFromNib;
@end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
//
// XTYRandomKeyboard.h
// KewBoard
//
// Created by XuTianyu on 16/4/1.
// Copyright © 2016年 Lakala. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface XTYRandomKeyboard : UIView
@property (strong, nonatomic)UIColor *titleColor;//文字颜色
@property (strong, nonatomic)UIFont *font;//字体
@property (strong, nonatomic)UIColor *numberBackgroundColor;//按钮块的北京颜色
@property (strong, nonatomic)UIColor *keyboardColor;//键盘背景颜色
@property (strong, nonatomic)UIImage *backgroundImage;//北京图片
/**
* 初始化方法
*
* @param color 按键文字颜色可传nil
* @param image 背景图片可传nil
*
* @return
*/
-(instancetype)initWithTitleColor:(UIColor *)color backGroundImage:(UIImage *)image;
/**
* 设置输入源的inputView
*
* @param view
*/
-(void)setInputView:(UIView *)view;
@end
//
// SetGradient.h
// Open
//
// Created by qinxuyang on 2021/11/25.
// Copyright © 2021 QXY. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SetGradient : NSObject
+(instancetype)instance;
- (void)setViewBackground:(UIView *)View fromColor:(NSString *)fromHexColorStr toColor:(NSString *)toHexColorStr fromCGPoint:(CGPoint)fromCGPoint toCGPoint:(CGPoint)toCGPoint;
@end
NS_ASSUME_NONNULL_END
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
//
// FaceImageModel.m
// Open
//
// Created by 雷俊博 on 2020/12/21.
// Copyright © 2020 黄江涛 . All rights reserved.
//
#import "FaceImageModel.h"
@implementation FaceImageModel
@end
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment