资源简介
ios. oc 实现的,手指在屏幕上滑动获得前一个矩形框. 可以自定义矩形位置.ios. oc 实现的,手指在屏幕上滑动获得前一个矩形框. 可以自定义矩形位置.
代码片段和文件信息
//
// CLWOverLayView.m
// CheLianWang
//
// Created by 马建奎 on 2018/11/22.
// Copyright © 2018年 MaJiankui. All rights reserved.
//
#import “CLWOverLayView.h“
@interface CLWOverLayView ()
{
CGFloat _selfHeight;
CGFloat _selfWidth;
CGRect _cropframe;
BOOL _topLineMove;
BOOL _leftLineMove;
BOOL _bottomLineMove;
BOOL _rightLineMove;
CGPoint _lastPoint;
CGPoint _endPoint;
CGPoint _topLeftPoint;
CGPoint _topRightPoint;
CGPoint _bottomLeftPoint;
CGPoint _bottomRightPoint;
BOOL _topLeftPointMove;
BOOL _topRightPointMove;
BOOL _bottomLeftPointMove;
BOOL _bottomRightPointMove;
}
@property (nonatomic strong) UIView *contentView;
@property (nonatomic strong) CAShapelayer *croplayer;
@end
@implementation CLWOverLayView
- (instancetype)initWithframe:(CGRect)frame {
if (self = [super initWithframe:frame]) {
[self addSubview:self.contentView];
[self addSubview:self.messageLabel];
[self addSubview:self.topLeftPointView];
[self addSubview:self.topRightPointView];
[self addSubview:self.bottomLeftPointView];
[self addSubview:self.bottomRightPointView];
[self setDefaultData];
}
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
}
#pragma mark -
- (void)setDefaultData {
_topLeftPointMove = false;
_topRightPointMove = false;
_bottomLeftPointMove = false;
_bottomRightPointMove = false;
_selfWidth = self.width;
_selfHeight = self.height;
_topLeftPoint = CGPointMake(0.0 0.0);
_topRightPoint = CGPointMake(0.0 0.0);
_bottomRightPoint = CGPointMake(0.0 0.0);
_bottomLeftPoint = CGPointMake(0.0 0.0);
//设置裁剪框区域
[self restframeData];
}
// 刷新尺寸信息
- (void)restframeData {
// x 最小 y 最小.
CGFloat x = _topLeftPoint.x < _topRightPoint.x ? _topLeftPoint.x : _topRightPoint.x;
CGFloat y = _topLeftPoint.y < _bottomLeftPoint.y ? _topLeftPoint.y : _bottomLeftPoint.y;
CGFloat width = [self getPintDistanceFromPoint:_topLeftPoint toPoint:_topRightPoint];
CGFloat height = [self getPintDistanceFromPoint:_topLeftPoint toPoint:_bottomLeftPoint];
//设置裁剪框尺寸
self.cropSize = CGSizeMake(width height);
//设置裁剪框区域
_cropframe = CGRectMake(xywidthheight);
[self transparentCutSquareArea];
}
// 矩形裁剪区域
- (void)transparentCutSquareArea {
self.cropframe = _cropframe;
//矩形裁剪区域
UIBezierPath *alphaPath = [UIBezierPath bezierPathWithRect:CGRectMake(0 0 _selfWidth _selfHeight)];
UIBezierPath *squarePath = [UIBezierPath bezierPathWithRect:_cropframe];
[alphaPath appendPath:squarePath];
CAShapelayer *shapelayer = [CAShapelayer layer];
shapelayer.path = alphaPath.CGPath;
shapelayer.fillRule = kCAFillRuleEvenOdd;
self.contentView.layer.mask = shapelayer;
//裁剪框
UIBezierPath *cropPath = [UIBezierPath bezierPathWithRect:CGRectM
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-12-22 15:06 overLayview\
文件 895 2018-12-22 15:00 overLayview\CLWOverLayView.h
目录 0 2018-12-22 15:06 __MACOSX\
目录 0 2018-12-22 15:06 __MACOSX\overLayview\
文件 333 2018-12-22 15:00 __MACOSX\overLayview\._CLWOverLayView.h
文件 13058 2018-12-22 15:00 overLayview\CLWOverLayView.m
文件 333 2018-12-22 15:00 __MACOSX\overLayview\._CLWOverLayView.m
相关资源
- 手势控制音乐播放器 源码
- 矩形空心线圈 计算器 LC谐振 计算器
- 在QGraphicsScene上画矩形
- 矩形件优化排样算法的研究与实现.
- 一个矩形件排样的较优算法.PDF
- OpenCV截取图像的任意区域(ROI)规则
- 一类矩形切割的优化模型
- 矩形和任意多边形的排样算法
- 论文研究-一种快速的有约束矩形件优
- qt 画旋转矩形
- OpenCV 飞行游戏手势控制源码.rar
- draw_qwidget.zip
- 用面向对象的思维设计相关类,从而
- 手势识别图像数据,三种手势每种1
- LISP最小矩形
- UE4触控屏手势输入SDK,单指点击,双
- 图像识别(13)——手势识别(1)—
- 判别手势的上下左右
- 连通区域内目标的最小外接矩形及其
- 矩形件排样优化的双向双原算法
- 图片随手势缩放平移,多点触控
- 2.45GHz矩形微带贴片天线仿真
- flash判断旋转矩形是否相交
- J2ME 圆和矩形绘制的追逐游戏
- 矩形件排样的模拟退火算法求解
- 通过摄像头采集图像进行手势检测
- 论文研究 - 矩形明渠横向剪切层及其
- ios-旋转后拖动改变大小.zip
- 图片上ROI区域矩形框的选取
- 基于离散粒子群算法的矩形件优化排
评论
共有 条评论