iOS圖案鎖,支援動畫、圖片、繪圖

來源:互聯網
上載者:User

標籤:

最近忙著搭建一個聊天用的架構,過幾天應該會整理寫出來吧,原理不難,但是實現後會省很多事。好久沒寫部落格,周末心血來潮寫了個圖案鎖,這東西沒什麼技術含量,網上一堆,這次這個圖案鎖順便聯絡了怎麼打包使用.a .bundle

註:支援動畫、圖片做觸摸點,另外,打包成.a的資源套件含了圖片,比較大,想自訂的童鞋,可以使用未打包的,然後自己定義資源,使用顏色的,會按照預設樣式繪圖,不好意思,現在不支援改變樣式,只能改變顏色,不過圖片可以彌補這個缺陷。

先上超連結: 

    普通版:PLView.zip

   .a含資源版:PatternLockView.a.zip

使用方法裡面有;

下面簡單的介紹下

 1 #import "ViewController.h" 2 #import "PatternLockView.h"//標頭檔 3  4 @interface ViewController () <PatternlockViewDelegate>//協議 5 @property (nonatomic,strong) PatternLockView * pv; //view 6 @end 7  8 @implementation ViewController 9 10 - (void)viewDidLoad {11     [super viewDidLoad];12     // Do any additional setup after loading the view, typically from a nib.13     _pv = [[PatternLockView alloc]initWithFrame:self.view.frame];//建議採用initWithFrame初始化14     15     [_pv setFillWay:PLFillWayAnimation andFillArray:nil];//設定填充方式,資源填nil則需要引入我之前製作的圖片資源16     17     [_pv setPointsSize:CGSizeMake(3, 3)];//設定點的個數,這裡是3*318     19     [_pv setPointRadius:50];//設定點的半徑20     21     _pv.delegate = self;22     23     [_pv startDraw];//一定要完成設定再調用該方法,24     25     [self.view addSubview:_pv];26 //    [_pv clearDraw]  //恢複預設樣式。27 }28 //協議方法29 - (void)PatternlockView:(PatternLockView*)patternlockView didTouchPointAtIndex:(NSInteger)index andCountOfTouchPoint:(NSInteger)count30 {31     NSLog(@"當前選擇的是:%ld ,當前供選擇了%ld個點。",(long)index,(long)count);32 }33 //協議方法34 - (void)PatternlockView:(PatternLockView*)patternlockView didEndTouchMoveWithIndexs:(NSArray<NSNumber*>*)indexs35 {36     NSLog(@"共選擇%@",indexs);37 }38 //協議方法39 - (void)PatternlockView:(PatternLockView*)patternlockView didEndTouchMoveWithString:(NSString*)string40 {41     NSLog(@"選擇結束的字串是:%@",string);42     43     NSLog(@"將樣式設定成成功樣式!");44     [_pv setStyleTo:PatternLockStyleSuccess];45 }

使用不是很麻煩,但是記得在  startDraw 之前完成相關設定,設定都有預設值。

差幾張:

iOS圖案鎖,支援動畫、圖片、繪圖

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.