IOS 手势UIPinchGestureRecognizer(缩放手势) UIRotationGestureRecognizer(旋转手势)
来源:互联网 发布:英语口语app软件 编辑:程序博客网 时间:2024/05/22 12:30
-(void)addPhotos{ //像系统相册展示的时候照片之间会有间距 int xWdith = 20; for(int i = 0; i<4; i++) { UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(xWdith+(xWdith + self.frame.size.width)*i, 0, self.frame.size.width, self.frame.size.height)]; imgView.backgroundColor = [UIColor orangeColor]; imgView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d.jpg",i]]; imgView.contentMode = UIViewContentModeScaleAspectFit; //缩放手势 UIPinchGestureRecognizer *pinchGestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)]; [imgView addGestureRecognizer:pinchGestureRecognizer]; imgView.userInteractionEnabled = YES; //旋转手势 UIRotationGestureRecognizer *rotationGestureRecognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(rotateView:)]; [imgView addGestureRecognizer:rotationGestureRecognizer]; [photoBrowse addSubview:imgView]; }}- (void) rotateView:(UIRotationGestureRecognizer *)rotationGestureRecognizer{ UIView *view = rotationGestureRecognizer.view;// if (rotationGestureRecognizer.state == UIGestureRecognizerStateBegan || rotationGestureRecognizer.state == UIGestureRecognizerStateChanged) {// view.transform = CGAffineTransformRotate(view.transform, M_PI/4);// NSLog(@"%f",rotationGestureRecognizer.rotation);// [rotationGestureRecognizer setRotation:0];// }// //3d旋转效果 CALayer *layer = view.layer; CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity; rotationAndPerspectiveTransform.m34 = 1.0 / -500; rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform,rotationGestureRecognizer.rotation, 0.0f, 1.0f, 0.0f); layer.transform = rotationAndPerspectiveTransform; }-(void)handlePinch:(UIPinchGestureRecognizer *)pinchGestureRecognizer{ UIImageView *view = (UIImageView *)pinchGestureRecognizer.view; // pinchGestureRecognizer.state == UIGestureRecognizerStateChanged if (pinchGestureRecognizer.state == UIGestureRecognizerStateBegan ) { view.transform = CGAffineTransformScale(view.transform, pinchGestureRecognizer.scale, pinchGestureRecognizer.scale); pinchGestureRecognizer.scale = 2; }}
0 0
- IOS 手势UIPinchGestureRecognizer(缩放手势) UIRotationGestureRecognizer(旋转手势)
- UIPinchGestureRecognizer手势
- iOS手势(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- 手势识别器(UIGestureRecognizer)- UIRotationGestureRecognizer(旋转)
- 手势 平移 缩放 旋转
- iOS 手势识别 旋转和缩放(捏合)
- UIPinchGestureRecognizer 放大、缩小手势
- iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)
- 取消searchBar 背景颜色设置
- JavaScript获取页面大小,滚动条位置,元素位置
- Maven 打包错误汇总
- OAuth 2.0
- allwinner A10平台下的ar6302驱动移植
- IOS 手势UIPinchGestureRecognizer(缩放手势) UIRotationGestureRecognizer(旋转手势)
- RowDataBound事件
- Matlab psf2otf与fft2函数的关系
- HDU1061 - Rightmost Digit (二分幂取模)
- 这段时间遇到的技术点总结
- #include <afx.h>头文件的作用
- EditText focusable editable enable
- POJ 2486 Apple Tree
- Customizing AIX Prompt