国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

IOS代碼筆記之左右滑動效果

2019-10-21 18:53:52
字體:
來源:轉載
供稿:網友

本文實例為大家分享了ios實現左右滑動操作代碼,供大家參考,具體內容如下

一、效果圖

 ios左右滑動,ios滑動

二、代碼
RootViewController.m

 - (void)viewDidLoad{  [super viewDidLoad];  // Do any additional setup after loading the view.    self.title=@"可以向左(右)滑動";    //向右滑動  UISwipeGestureRecognizer *recognizerLeft;  recognizerLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFromLeft:)];  [recognizerLeft setDirection:(UISwipeGestureRecognizerDirectionLeft)];  [self.view addGestureRecognizer:recognizerLeft];    //向左滑動  UISwipeGestureRecognizer *recognizerRight;  recognizerRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFromRight:)];  [recognizerRight setDirection:(UISwipeGestureRecognizerDirectionRight)];  [self.view addGestureRecognizer:recognizerRight];}#pragma -mark -手勢滑動//向左滑動-(void)handleSwipeFromLeft:(UISwipeGestureRecognizer *)recognizer {    NSLog(@"-------進入向左手勢滑動姿勢-------------");  if (recognizer.direction==UISwipeGestureRecognizerDirectionLeft) {        UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"提醒" message:@"進入向左手勢滑動姿勢" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"確定", nil];    [alert show];          }}//向右滑動-(void)handleSwipeFromRight:(UISwipeGestureRecognizer *)recognizer {    NSLog(@"-------進入向右手勢滑動姿勢-------------");  if (recognizer.direction==UISwipeGestureRecognizerDirectionRight) {        UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"提醒" message:@"進入向右手勢滑動姿勢" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"確定", nil];    [alert show];      }}

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


注:相關教程知識閱讀請移步到IOS開發頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 清水县| 普格县| 塘沽区| 阿巴嘎旗| 北流市| 宝坻区| 确山县| 西安市| 莱阳市| 金昌市| 铁岭市| 扶沟县| 江油市| 加查县| 五峰| 芷江| 汉寿县| 咸丰县| 铜梁县| 乡城县| 晋宁县| 上饶市| 嫩江县| 隆林| 滨州市| 潜山县| 舟曲县| 肥西县| 永宁县| 民权县| 衡南县| 长岭县| 确山县| 砀山县| 南城县| 会昌县| 巨鹿县| 新津县| 乳源| 彰武县| 汉阴县|