九格宫蓝牙图形android 手势密码码怎么设置?

⊙0⊙→学习之路
原文:大家可以看到我之前的文章[]
本文是使用苹果语言对其进行了移植 颜色配色是拾取的支付宝的颜色
本文的目的说明:语言是想通的 &只要思路在 语言只是手段而已
这是本人自学swift一个礼拜 然后花了三个小时写出来的肯定会有不规范的地方&
因为思路比较简单 大家可以参考 javascript 版本
废话不多说先上效果&
(对了 大家如果能在转载的地方注明出处的话 那就是极好的 &&)
自定义一个UIView对象,注意需要在启动的controller中实例化这个对象然后给controller附上
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.view = NineCellLockView(frame: CGRectZero)
然后是主要的代码UIView:
import UIKit
class NineCellLockView: UIView {
var fingerPoint:CGPoint = CGPoint()
var linePointointCollection:Array&CGPoint& = Array&CGPoint&()
var ninePointCollection:Array&CGPoint& = Array&CGPoint&()
var selectPointIndexCollection:Array&Int& = Array&Int&()
var circleRadius:CGFloat = 28
var circleCenterDistance:CGFloat = 96
var firstCirclePointX:CGFloat = 96
var firstCirclePointY:CGFloat = 200
func FillNinePointCollection()
for row in 0...2
for column in 0...2
let tempX:CGFloat = CGFloat(column)*self.circleCenterDistance + self.firstCirclePointX
let tempY:CGFloat = CGFloat(row)*self.circleCenterDistance + self.firstCirclePointY
self.ninePointCollection.append(CGPoint(x: tempX,y:tempY))
func drawCicle(centerPoint:CGPoint,index:Int)
var context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 2.0);
CGContextAddArc(context, centerPoint.x, centerPoint.y, self.circleRadius, 0.0, CGFloat(M_PI * 2.0), 1)
let currentIsSelected:Bool = contains(self.selectPointIndexCollection, index)
if(currentIsSelected)
//96 169 252
CGContextSetStrokeColorWithColor(context, UIColor(red: 96/255.0, green: 169/255.0, blue: 252/255.0, alpha: 1).CGColor)
CGContextSetStrokeColorWithColor(context,
UIColor(red: 144/255.0, green: 149/255.0, blue: 173/255.0, alpha: 1).CGColor)
CGContextStrokePath(context);
CGContextAddArc(context, centerPoint.x, centerPoint.y, self.circleRadius, 0.0, CGFloat(M_PI * 2.0), 1)
CGContextSetFillColorWithColor(context,
UIColor(red: 35/255.0, green: 39/255.0, blue: 54/255.0, alpha: 1).CGColor)
CGContextFillPath(context)
if(currentIsSelected)
CGContextAddArc(context, centerPoint.x, centerPoint.y, 10, 0.0, CGFloat(M_PI * 2.0), 1)
CGContextSetFillColorWithColor(context, UIColor(red: 96/255.0, green: 169/255.0, blue: 252/255.0, alpha: 1).CGColor)
CGContextFillPath(context)
func drawNineCircle()
for p in 0...self.ninePointCollection.count-1
self.drawCicle(self.ninePointCollection[p],index:p);
override init(frame:CGRect)
super.init(frame:frame)
//26 29 40
self.backgroundColor = UIColor(red: 35/255.0, green: 39/255.0, blue: 54/255.0, alpha: 1)
FillNinePointCollection()
required init(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
func DrawLine(p1:CGPoint,p2:CGPoint)
var bp = UIBezierPath()
bp.lineWidth
bp.lineCapStyle = kCGLineCapRound
UIColor(red: 96/255.0, green: 169/255.0, blue: 252/255.0, alpha: 1).setStroke()
bp.moveToPoint(p1)
bp.addLineToPoint(p2)
bp.stroke()
override func drawRect(rect: CGRect) {
if(self.selectPointIndexCollection.count & 0)
for index in 0...self.selectPointIndexCollection.count-1
let nextIndex = index+1
if(nextIndex &= self.selectPointIndexCollection.count-1)
let firstPointIndex=self.selectPointIndexCollection[index]
let secondPointIndex=self.selectPointIndexCollection[nextIndex]
self.DrawLine(self.ninePointCollection[firstPointIndex],p2:self.ninePointCollection[secondPointIndex])
if self.fingerPoint.x != -100
let lastPointIndex=self.selectPointIndexCollection[self.selectPointIndexCollection.count-1]
self.DrawLine(self.ninePointCollection[lastPointIndex],p2:fingerPoint)
self.drawNineCircle()
func distanceBetweenTwoPoint(p1:CGPoint,p2:CGPoint)-&CGFloat
return pow(pow((p1.x-p2.x), 2)+pow((p1.y-p2.y), 2), 0.5)
func CircleIsTouchThenPushInSelectPointIndexCollection(fingerPoint:CGPoint)
for index in 0...self.ninePointCollection.count-1
if(!contains(self.selectPointIndexCollection, index))
if(self.distanceBetweenTwoPoint(fingerPoint,p2:self.ninePointCollection[index]) &= circleRadius)
self.selectPointIndexCollection.append(index);
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
var t = touches.anyObject() as UITouch
self.selectPointIndexCollection.removeAll(keepCapacity: false)
self.fingerPoint = t.locationInView(self)
self.CircleIsTouchThenPushInSelectPointIndexCollection(fingerPoint);
self.setNeedsDisplay()
override func touchesMoved(touches: NSSet, withEvent event: UIEvent) {
var t = touches.anyObject() as UITouch
self.fingerPoint = t.locationInView(self)
self.CircleIsTouchThenPushInSelectPointIndexCollection(self.fingerPoint);
self.setNeedsDisplay()
override func touchesEnded(touches: NSSet, withEvent event: UIEvent) {
self.fingerPoint.x = -100
self.setNeedsDisplay()
if(self.selectPointIndexCollection.count&0)
var ReStr:String = ""
for index in 0...self.selectPointIndexCollection.count-1
ReStr += String(self.selectPointIndexCollection[index]) + ","
let alertV = UIAlertView(title: "您的结果", message: ReStr, delegate: nil, cancelButtonTitle: "我知道了")
alertV.show()
阅读(...) 评论()怎么假简单漂亮的九宫格手势密码图案_百度知道
怎么假简单漂亮的九宫格手势密码图案
怎么假简单漂亮的九宫格手势密码图案
我有更好的答案
153684112358123578912369按着数字滑,看看你最感兴趣的是哪个
采纳率:80%
为您推荐:
其他类似问题
九宫格 手势 图案 密码的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。只有VIP会员才可以下载课程视频哦~
你可以添加极客老师QQ获取课程相关资料~
九宫格布局按钮
开通极客学院VIP会员,免费观看全部会员课程
最低 21.6 元 / 月
VIP会员尊享特权
观看全部会员课程
720P高清视频下载
已有会员账号,请
视频太卡?试试切换线路
本课时讲解点击手势,单击和双击,手势互斥原则的概念和解决方法,捏合手势缩放视图以及轻扫手势的使用。
本课时讲解拖移、旋转和长按手势的声明以及响应方法,根据其属性和方法来深入理解手势。
本课时讲解通过 storyboard 添加背景视图,并通过代码布局按钮,运用到了九宫格布局算法,对触摸事件和按钮的功能进行代码封装。
本课时讲解将按钮根据手势触摸连线,修改按钮选中状态、手势结束后取消连线、最后设置代理方法来判断密码是否正确。
只有成为VIP会员才能提问&回复,快吧!如果你还没有账号你可以一个账号。
添加新技术问题
课程 [九宫格布局按钮]
中已存在问题
添加新技术问题
问题描述越详细,被解答的速度越快
有新回答时请邮件提醒我
着急,拜托快点
不急,慢慢解决
关联课程 [九宫格布局按钮]&>&一个实用的Android九宫格手势图案解锁控件
一个实用的Android九宫格手势图案解锁控件
上传大小:1.79MB
一个Android九宫格手势图案解锁的控件,类似于Android系统自带的九宫格图案解锁,我写了注释,编码方式utf-8.
综合评分:1(1位用户评分)
下载个数:
{%username%}回复{%com_username%}{%time%}\
/*点击出现回复框*/
$(".respond_btn").on("click", function (e) {
$(this).parents(".rightLi").children(".respond_box").show();
e.stopPropagation();
$(".cancel_res").on("click", function (e) {
$(this).parents(".res_b").siblings(".res_area").val("");
$(this).parents(".respond_box").hide();
e.stopPropagation();
/*删除评论*/
$(".del_comment_c").on("click", function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_invalid/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parents(".conLi").remove();
alert(data.msg);
$(".res_btn").click(function (e) {
var parentWrap = $(this).parents(".respond_box"),
q = parentWrap.find(".form1").serializeArray(),
resStr = $.trim(parentWrap.find(".res_area_r").val());
console.log(q);
//var res_area_r = $.trim($(".res_area_r").val());
if (resStr == '') {
$(".res_text").css({color: "red"});
$.post("/index.php/comment/do_comment_reply/", q,
function (data) {
if (data.succ == 1) {
var $target,
evt = e || window.
$target = $(evt.target || evt.srcElement);
var $dd = $target.parents('dd');
var $wrapReply = $dd.find('.respond_box');
console.log($wrapReply);
//var mess = $(".res_area_r").val();
var mess = resS
var str = str.replace(/{%header%}/g, data.header)
.replace(/{%href%}/g, 'http://' + window.location.host + '/user/' + data.username)
.replace(/{%username%}/g, data.username)
.replace(/{%com_username%}/g, data.com_username)
.replace(/{%time%}/g, data.time)
.replace(/{%id%}/g, data.id)
.replace(/{%mess%}/g, mess);
$dd.after(str);
$(".respond_box").hide();
$(".res_area_r").val("");
$(".res_area").val("");
$wrapReply.hide();
alert(data.msg);
}, "json");
/*删除回复*/
$(".rightLi").on("click", '.del_comment_r', function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_comment_del/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parent().parent().parent().parent().parent().remove();
$(e.target).parents('.res_list').remove()
alert(data.msg);
//填充回复
function KeyP(v) {
var parentWrap = $(v).parents(".respond_box");
parentWrap.find(".res_area_r").val($.trim(parentWrap.find(".res_area").val()));
评论共有1条
老是解锁错误
综合评分:
积分/C币:3
stevenhu_223
综合评分:
积分/C币:5
Jimmy丶八毛钱
综合评分:
积分/C币:3
综合评分:
积分/C币:3
VIP会员动态
CSDN下载频道资源及相关规则调整公告V11.10
下载频道用户反馈专区
下载频道积分规则调整V1710.18
spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip
资源所需积分/C币
当前拥有积分
当前拥有C币
输入下载码
为了良好体验,不建议使用迅雷下载
一个实用的Android九宫格手势图案解锁控件
会员到期时间:
剩余下载个数:
剩余积分:0
为了良好体验,不建议使用迅雷下载
积分不足!
资源所需积分/C币
当前拥有积分
您可以选择
程序员的必选
绿色安全资源
资源所需积分/C币
当前拥有积分
当前拥有C币
(仅够下载10个资源)
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
你当前的下载分为234。
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可返还被扣除的积分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
一个实用的Android九宫格手势图案解锁控件}

我要回帖

更多关于 手势识别蓝牙音响 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信