ios手勢識別之輕掃

來源:互聯網
上載者:User

標籤:

 1 - (void)viewDidLoad 2 { 3     [super viewDidLoad]; 4      5     // 向上 6     UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc] init]; 7     // 設定輕掃的方向 8     swipe.direction = UISwipeGestureRecognizerDirectionUp; 9     [self.customView addGestureRecognizer:swipe];10     [swipe addTarget:self action:@selector(swipeView)];11     12     // 向下13     UISwipeGestureRecognizer *swipe2 = [[UISwipeGestureRecognizer alloc] init];14     // 設定輕掃的方向15     swipe2.direction = UISwipeGestureRecognizerDirectionDown;16     [self.customView addGestureRecognizer:swipe2];17     [swipe2 addTarget:self action:@selector(swipeView2)];18     19     // 左邊20     UISwipeGestureRecognizer *swipe3 = [[UISwipeGestureRecognizer alloc] init];21     // 設定輕掃的方向22     swipe3.direction = UISwipeGestureRecognizerDirectionLeft;23     [self.customView addGestureRecognizer:swipe3];24     [swipe3 addTarget:self action:@selector(swipeView3)];25     26     // 右邊27     UISwipeGestureRecognizer *swipe4 = [[UISwipeGestureRecognizer alloc] init];28     // 設定輕掃的方向29     swipe4.direction = UISwipeGestureRecognizerDirectionRight;30     [self.customView addGestureRecognizer:swipe4];31     [swipe4 addTarget:self action:@selector(swipeView4)];32     33     34     35 }36 - (void)swipeView437 {38     NSLog(@"輕掃事件右");39 }40 41 - (void)swipeView342 {43     NSLog(@"輕掃事件左");44 }45 46 - (void)swipeView247 {48     NSLog(@"輕掃事件下");49 }50 51 - (void)swipeView52 {53     NSLog(@"輕掃事件上");54 }

 

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.