iOS OC 手勢密碼功能

2021-10-25 15:08:06 字數 2535 閱讀 8607

資源。

效果。

**結構。

主體**。

// ssmmview.h

#import

@class ssmmview;

ns_assume_nonnull_begin

@protocol ssmmviewdelegate -(

void

)ssmmview:

(ssmmview *

)view passwordstring:

(nsstring *

)string;

@end

@inte***ce ssmmview : uiview

@property

(nonatomic,weak) iddelegate;

@end

ns_assume_nonnull_end

// ssmmview.m

#import "ssmmview.h"

@inte***ce ssmmview (

)@end

@implementation ssmmview

-(instancetype)initwithframe:

(cgrect)frame

return

self;}

-(void

)initdata -(

void

)initview }-

(void

)resize }-

(void

)setframe:

(cgrect)frame -(

void

)touchesbegan:

(nsset

>

*)touches withevent:

(uievent *

)event

break;}

}}-(

void

)touchesmoved:

(nsset

>

*)touches withevent:

(uievent *

)event

break;}

}

lastpoint_ = point;

[self setneedsdisplay];}

-(void

)touchesended:

(nsset

>

*)touches withevent:

(uievent *

)event

[arrselbutton_ removeallobjects];if

(_delegate &&

[_delegate respondstoselector:

@selector

(ssmmview:passwordstring:)]

)

lastpoint_ = cgpointzero;

[self setneedsdisplay];}

}-(void

)drawrect:

(cgrect)rect

else

i ++;}

if(!cgpointequaltopoint

(lastpoint_, cgpointzero)

)cgcontextstrokepath

(context);}

}@end

// viewcontroller.m

#import "viewcontroller.h"

#import "ssmmview.h"

@inte***ce viewcontroller (

)@end

@implementation viewcontroller-(

void

)viewdidload -(

void

)ssmmview:

(ssmmview *

)view passwordstring:

(nsstring *

)string

@end

手勢密碼demo swift4 0

最近有需求要求換成和支付寶一樣樣式的手勢密碼,帶箭頭指示的。如圖 圓圈畫圖類 import uikit 圓的狀態 enum xcthecircleviewstate int class xcthecircleview uiview set 型別 var type xcthecircleviewtyp...

QT繪製手勢密碼介面

1 封裝類 ifndef afguesture h define afguesture h 手勢輸入控制項 輸入完成時,發出訊號result 外部呼叫者負責處理結果。include class afguesture public qframe q object signals void result...

手勢密碼VS指紋密碼,哪個更安全?

android的手勢密碼,現如今的指紋解鎖,再加上古老的文字密碼都是有破綻可循的。三年前過年前我去鼓浪嶼旅了個遊,不幸丟失了我的 iphone 5,考慮到過年的開支,買了臺小公尺。當時棄蘋果投 android 的原因除了 還有那時讀的一篇文章 fbi 無法破解 android 手勢密碼 fbi 在法...