接上篇:transform
手勢配合使用transform
手勢可以新增在任何想要的地方,一般新增在imageview上。
gesturerecognizer 手勢識別器
使用手勢,首先要確定控制項的手勢互動式開啟的:
//開啟互動
self.rv.imv.userinteractionenabled = yes;
1、輕拍
uitapgesturerecognizer * tap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(tapaction:)];
設定屬性
tap.numberoftapsrequired = 1; // 次數
tap.numberoftouchesrequired = 2; // 觸控數
//輕拍
- (void)tapaction:(uigesturerecognizer *)sender
//將手勢新增在檢視上
[self.rv.imv addgesturerecognizer:tap];
2、長按
uilongpressgesturerecognizer * longpress = [[uilongpressgesturerecognizer alloc] initwithtarget:self action:@selector(longpress:)];
[self.rv.imv addgesturerecognizer:longpress];
//長按
- (void)longpress:(uilongpressgesturerecognizer *)sender
else if (sender.state == uigesturerecognizerstateended) }
3、輕掃
uiswipegesturerecognizer * swipe = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(swipeaction:)];
屬性 輕掃方向 只能相對的方向,左右或上下
swipe.direction = uiswipegesturerecognizerdirectionleft | uiswipegesturerecognizerdirectionright;
//輕掃
- (void)swipeaction:(uiswipegesturerecognizer *)sender
//將手勢新增在檢視上
[self.rv.imv addgesturerecognizer:swipe];
4、拖動
uipangesturerecognizer * pan = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(panaction:)];
//拖動
- (void)panaction:(uipangesturerecognizer *)sender
//將手勢新增在檢視上
[self.rv.imv addgesturerecognizer:pan];
5、旋轉
uirotationgesturerecognizer * rotation = [[uirotationgesturerecognizer alloc] initwithtarget:self action:@selector(rotationaction:)];
//旋轉
- (void)rotationaction:(uirotationgesturerecognizer *)sender
//將手勢新增在檢視上
[self.rv.imv addgesturerecognizer:rotation];
6、捏合
uipinchgesturerecognizer * pinch = [[uipinchgesturerecognizer alloc] initwithtarget:self action:@selector(pinchaction:)];
//捏合
- (void)pinchaction:(uipinchgesturerecognizer *)sender
//將手勢新增在檢視上
[self.rv.imv addgesturerecognizer:pinch];
UI基礎 手勢解鎖簡單實現
手勢解鎖可以說是手機的乙個標誌了,幾乎所有涉及到安全的軟體都有手勢解鎖功能。其實實現起來也相當簡單,雖然思路比較簡單,但是對我來說注意點還是比較多的。根控制器view被我自定義乙個新的view代替了 bgview.m 05 手勢解鎖 created by styshy on 15 11 4.impo...
CSS CSS基礎之十四
第一步 turnpage2.html 純css 實現翻頁 a 1 b 2 c 3 第二步 turnpage.css body dl dt dd dl dd dt img a a hover 分析 1 dl dt 同時運用 position absolute 2 dd overflow hidden ...
ios IOS學習之基礎UI介面總結4
下面記錄的是自己學習uitableview 檢視 和android的listview類似 viewdidload tableview uitableview alloc intiwithframe view.bounds style uitableviewstyleplain listarr lis...