当前位置: 首页 > news >正文

西宁建一个网站公司网站开发工程师招聘

西宁建一个网站公司,网站开发工程师招聘,城乡建设官网,免费的黄冈网站有哪些平台游戏软件轻按(UITapGestureRecognizer) -- 用一个或多个手指在屏幕上轻按。 按住(UILongPressGestureRecognizer) -- 用一个或多个手指在屏幕上按住。 轻扫(UISwipeGestureRecognizer) -- 用一个或多个手指沿特定方向轻扫。 张合(UIPinchGestureRecognizer) -- 张合手指以缩放对象。 旋…轻按(UITapGestureRecognizer) -- 用一个或多个手指在屏幕上轻按。 按住(UILongPressGestureRecognizer) -- 用一个或多个手指在屏幕上按住。 轻扫(UISwipeGestureRecognizer) -- 用一个或多个手指沿特定方向轻扫。 张合(UIPinchGestureRecognizer) -- 张合手指以缩放对象。 旋转(UIRotationGestureRecognizer) -- 沿圆形滑动两个手指。 平移(UIPanGestureRecognizer) -- 触摸并拖曳。 通过指定要使用的识别器(Recognizer)类型并将其加入到视图(UIView)中就能自动收到触发的多点触摸事件。有两种方式添加手势识别器使用代码或使用Interface Builder编辑器以可视化方式添加。 可视化方式添加手势识别器 1. 先找到手势控件组 2. 选中某一识别器直接拖拽到控件上 识别器将作用于该控件实际是增加了一个属性名为gestureRecognizers与该控件的连接。一个识别器可以连接多个控件 需要注意的是有一些控件(例如Label)默认没有允许User Interaction Enabled。这样手势将不生效需要勾选后手势才能生效对应的方法是setUserInteractionEnabled。 3. 定义操作 代码添加手势识别器 - (IBAction)testTap:(id)sender {NSLog(Tap);//得到触点在视图中的坐标CGPoint point [(UITapGestureRecognizer*)sender locationInView:self.btnTest];NSLog(x:%.2f,y:%.1f,point.x,point.y); }- (void)viewDidLoad {UITapGestureRecognizer *tapRecognizer [[UITapGestureRecognizer alloc] initWithTarget:self action:selector(testTap:)];tapRecognizer.numberOfTapsRequired 1;tapRecognizer.numberOfTouchesRequired 1;[self.btnTest addGestureRecognizer:tapRecognizer];[super viewDidLoad]; } 代码里的initWithTarget:self是指明方法testTap所属的对象。大多数情况下简单指定为当前类就够了但有时候也会写在外部类 #import Foundation/Foundation.hinterface MyClass : NSObject- (void)testTap;end MyClass.h #import MyClass.himplementation MyClass- (void)testTap {NSLog(a tap!); } MyClass.m #import UIKit/UIKit.h #import MyClass.hinterface ViewController : UIViewController {MyClass *myClass; }property (strong, nonatomic) IBOutlet UIButton *btnTest;end ViewController.h #import ViewController.h #import MyClass.himplementation ViewController synthesize btnTest;- (void)viewDidLoad {myClass [[MyClass alloc] init];UITapGestureRecognizer *tapRecognizer [[UITapGestureRecognizer alloc] initWithTarget:myClass action:selector(testTap)];[self.btnTest addGestureRecognizer:tapRecognizer];[super viewDidLoad]; } ViewController.m 注意MyClass *myClass一定要声明在头文件ViewController.h如果声明在ViewController.m会找不到testTap方法。这是因为在ViewController.m里会把MyClass声明成立局部变量导致MyClass中的action不能正确识别自身所属的类。 轻按(UITapGestureRecognizer)  轻按手势可以设定按下次数和触点数 numberOfTapsRequired -- 需要轻按对象多少次才能识别出轻按手势默认为1。 numberOfTouchesRequired -- 需要有多少个手指在对象上才能识别出轻按手势默认为1。 轻扫(UISwipeGestureRecognizer)  轻扫手势可以设定方向和触点数 direction -- 轻扫方向值是枚举UISwipeGestureRecognizerDirection中的一个分别为 UISwipeGestureRecognizerDirectionRight(向右默认值)UISwipeGestureRecognizerDirectionLeft(向左)UISwipeGestureRecognizerDirectionUp(向上)UISwipeGestureRecognizerDirectionDown(向下) numberOfTouchesRequired -- 需要有多少个手指在对象上才能识别出轻按手势默认为1。 P.s 如果要识别并相应不同的轻扫方向必须实现多个轻扫手势识别器。通过编写代码可让一个轻扫手势识别器响应多个轻扫方向但无法区分不同的轻扫方向。例如 - (void)viewDidLoad { UISwipeGestureRecognizer *leftSwipeGesture [[UISwipeGestureRecognizer alloc] initWithTarget:self action:selector(testSwipe:)];leftSwipeGesture.direction UISwipeGestureRecognizerDirectionLeft;[self.btnTest addGestureRecognizer:leftSwipeGesture];UISwipeGestureRecognizer *upSwipeGesture [[UISwipeGestureRecognizer alloc] initWithTarget:self action:selector(testSwipe:)];upSwipeGesture.direction UISwipeGestureRecognizerDirectionUp;[self.btnTest addGestureRecognizer:upSwipeGesture];[super viewDidLoad]; }- (IBAction)testSwipe:(id)sender {UISwipeGestureRecognizer *swipeGesture (UISwipeGestureRecognizer *)sender;if(swipeGesture.directionUISwipeGestureRecognizerDirectionLeft){NSLog(left swipe!);}else if(swipeGesture.directionUISwipeGestureRecognizerDirectionUp){NSLog(up swipe!);} } 张合(UIPinchGestureRecognizer)  轻扫手势可以设定缩放值和速度 scale -- 默认为1。在必要的情况下可以通过改变这个值来调整放大缩小因子。 velocity -- (张合手势发生的)速度初始值为0。 - (void)viewDidLoad { UIPinchGestureRecognizer *pinchGesture [[UIPinchGestureRecognizer alloc] initWithTarget:self action:selector(testPinch:)];[self.imgView1 addGestureRecognizer:pinchGesture];[self.imgView1 setUserInteractionEnabled:YES];[super viewDidLoad]; }- (IBAction)testPinch:(id)sender {CGFloat scale ((UIPinchGestureRecognizer *)sender).scale;self.imgView1.frame CGRectMake(self.imgView1.frame.origin.x, self.imgView1.frame.origin.y, self.imgView1.frame.size.width*scale, self.imgView1.frame.size.height*scale); } 旋转(UIRotationGestureRecognizer)  旋转手势可以设定旋转角度和速度 rotation -- 旋转角度(弧度值可通过公式转换度数弧度数*180/Pi弧度数度数*Pi/180)初始值为0随着每个旋转手势逐渐累积。可以将默认的初始旋转角度0修改为任何值这样后续的旋转手势将以指定的值为起点。 velocity -- 速度初始值为0。 - (void)viewDidLoad {UIRotationGestureRecognizer *rotationGesture [[UIRotationGestureRecognizer alloc] initWithTarget:self action:selector(testRotation:)];[self.imgView1 addGestureRecognizer:rotationGesture];[self.imgView1 setUserInteractionEnabled:YES];[super viewDidLoad]; }- (IBAction)testRotation:(id)sender {CGFloat rotation ((UIRotationGestureRecognizer *)sender).rotation;self.imgView1.transform CGAffineTransformMakeRotation(rotation); } 摇动识别器 摇动的处理方式与其它手势不同必须拦截一个类型为UIEventTypeMotion的UIEvent。为此视图或视图控制器必须是响应者链中的第一响应者(FirstResponder)还必须实现方法motionEnded:withEvent。 step 1. 成为第一响应者(FirstResponder) 通过方法canBecomeFirstResponder允许视图控制器成为第一响应者这个方法除了返回YES外什么都不做 - (BOOL)canBecomeFirstResponder {return YES; } 在视图控制器加载视图后立即发送消息becomeFirstResponder让视图成为第一响应者 - (void)viewDidAppear:(BOOL)animated {[self becomeFirstResponder];[super viewDidAppear:animated]; } step 2. 响应摇动手势 实现方法motionEnded:withEvent - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {if(motion UIEventSubtypeMotionShake){NSLog(Shaking things up!);} } 转载于:https://www.cnblogs.com/CoderWayne/p/3596828.html
http://www.zqtcl.cn/news/173972/

相关文章:

  • 了解网站建设管理网站开发的可行性研究报告
  • 淄博网站设计策划方案公司中文域名.网站
  • 综合网站系统电脑怎么做软件开发
  • 网站虚拟主持人制作国内网站建设排名
  • 上海房地产网站建设报价wordpress.备份
  • 网站建设运营维护合同专用车网站建设价格
  • 建设部咨询资质网站平台类网站建设公司
  • wap 网站 源码网站建立
  • 辽阳专业建设网站公司山东省工程建设招标信息网站
  • 下载专门做初中数学题的网站佛山网站制作在线
  • 永康物流网站蒙牛企业网站建设规划书
  • 网站开发发和后台开发有什么区别马鞍山网站建设价格
  • 广州建设银行预约公积金网站怎么下载ppt免费模板
  • 网站策划的基本过程网站设置在哪
  • 内蒙古住房和城乡建设网站网站建设需要购买什么
  • 网站做调查问卷给钱的兼职南通营销网站制作
  • 开个微网站需要什么自己制作网页的步骤
  • 有专业做线切割配件的网站吗中国婚恋网站排名
  • 做ppt网站大全中国工程建设信息网站
  • 汉滨区住房和城乡建设局网站淘宝客购物网站的怎么做
  • 一个网站用多个域名分页网站
  • 门户网站举例phpstuy wordpress
  • 做网站许昌美业管理软件系统排名
  • 温州市建设工程质量安全管理总站贵阳最新消息今天
  • 成都服装网站建设工作是否能给我们带来快乐
  • 电商网站建设综述长沙高端网站建设
  • 网站建设有哪些环节怎么申请网址
  • 做网站要什么软件经典网站首页
  • 个人网站备案转公司备案长沙网站seo报价
  • 上海网站开发建设电话电影vip网站建设步骤