情侣心形密码锁屏手势密码九宫格

&>&&>&&>&&>&IOS自定义九宫格手势图案密码View
IOS自定义九宫格手势图案密码View
上传大小:39KB
项目需要,完全自定义实现,包含完整demo,可直接拷贝到其他项目使用!可扩展!
综合评分:1(1位用户评分)
所需积分:5
下载次数:12
审核通过送C币
创建者:nigelyq
创建者:liuyujie0514
课程推荐相关知识库
上传者其他资源上传者专辑
移动开发热门标签
VIP会员动态
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
android服务器底层网络模块的设计方法
所需积分:0
剩余积分:720
您当前C币:0
可兑换下载积分:0
兑换下载分:
兑换失败,您当前C币不够,请先充值C币
消耗C币:0
你当前的下载分为234。
IOS自定义九宫格手势图案密码View
会员到期时间:
剩余下载次数:
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可奖励20下载分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:喜欢就猛击分享!
个性网内容精选【情侣】九宫格锁屏图案_魅族吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
【情侣】九宫格锁屏图案收藏
虽然魅族没有九宫格~但是如果用的上就珍藏起来吧~(魅族可以用软件做到九宫格锁屏)     ————来自魅族MX2,如玉凝成,纯简随心,梦想尽在掌握!
哦星期天,电台情歌放到午夜通了电你的画面渐渐浮现~
请问这是什么软件啊,mx2能用吗?回复1楼:
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或Swift 简简单单实现手机九宫格手势密码解锁 - 推酷
Swift 简简单单实现手机九宫格手势密码解锁
本文是使用苹果语言对其进行了移植 颜色配色是拾取的支付宝的颜色
本文的目的说明:语言是想通的 &只要思路在 语言只是手段而已
这是本人自学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
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()
self.setNeedsDisplay()
已发表评论数()
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见
正文不准确
标题不准确
排版有问题
主题不准确
没有分页内容
图片无法显示
视频无法显示
与原文不一致

我要回帖

更多关于 九宫格手势密码心形 的文章

 

随机推荐