UIScrollView 在手指点击的坐标处放大
写了一个extension,如下:
extension UIScrollView{
///在ScrollView上的某个点放大
func zoomWithPoint(var zoomPoint:CGPoint,toScale:CGFloat,animated:Bool){
var contentSize:CGSize = CGSize.zeroSize
contentSize.width = self.contentSize.width / self.zoomScale
contentSize.height = self.contentSize.height / self.zoomScale
zoomPoint.x = (zoomPoint.x / self.bounds.size.width) * contentSize.width
zoomPoint.y = (zoomPoint.y / self.bounds.size.height) * contentSize.height
var zoomSize:CGSize = CGSize.zeroSize
zoomSize.width = self.bounds.size.width / toScale
zoomSize.height = self.bounds.size.height / toScale
var zoomRect:CGRect = CGRect.zeroRect
zoomRect.origin.x = zoomPoint.x - zoomSize.width / 2.0
zoomRect.origin.y = zoomPoint.y - zoomSize.height / 2.0
zoomRect.size.width = zoomSize.width
zoomRect.size.height = zoomSize.height
self.zoomToRect(zoomRect, animated: animated)
}
}
UIScrollView 在手指点击的坐标处放大的更多相关文章
- touches获得手指点击的坐标
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObjec ...
- unity 单指双指事件(单指点击移动,双指滑动拖放)
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TouchCon ...
- 点击弹出 +1放大效果 -- jQuery插件
20140110更新: <!doctype html> <html> <head> <meta charset="UTF-8"> & ...
- 【Android测试】【随笔】模拟双指点击
◆版权声明:本文出自胖喵~的博客,转载必须注明出处. 转载请注明出处:http://www.cnblogs.com/by-dream/p/5258660.html 手势 看到这个标题,很多人会想一想 ...
- Activity切换动画---点击哪里从哪放大
emmmm,这次来梳理一下 Activity 切换动画的研究.首先,老规矩,看一下效果图: 效果图 这次要实现的动画效果就是类似于上图那样,点击某个 view,就从那个 view 展开下个 Activ ...
- 关于win10触控板两指点击无效的问题
一.前言 最近发现公司的本本两指点击触控板没有反应,单指和三指点击触控板都是正常的.网上也搜了 一些解决的方法,最开始因为没有明确自己的触控板是Synaptics还是Elan的,导致没有解决.首先我们 ...
- iOS上手指点击波纹效果的实现
https://www.jianshu.com/p/35e6f53ca0fe 2016.10.19 22:00* 字数 135 阅读 2468评论 2喜欢 7 闲暇时间做了一个反馈手指点击屏幕的效果, ...
- ios点击输入框,界面放大解决方案
当我们编写的input宽度没有占满屏幕宽度,而且又没有申明meta,就会出现点击输入框,界面放大这个问题. 下面我直接给出解决方案: <meta name="viewport" ...
- 在手机上点击input框时会放大页面
加上 <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-s ...
随机推荐
- 修改Qt源码遇到的问题
1.修改源码后用新的Qt版本调试Qt工程,程序直接崩溃:
- tp框架-------验证码
验证码我们一般很常见,在注册或登录时,都可以用的到,下面我们就来看看它的代码和用法 加验证码是为了防止表单攻击的一种方式,为了我们的程序更加的安全 在tp框架中它自带了一个验证码的类,我们先来看一下 ...
- Spring学习(一)-----Spring 模块详解
官方下载链接:http://repo.spring.io/release/org/springframework/spring/ Spring 模块详解: Core 模块 spring-beans-3 ...
- Intellij IDEA 热部署插件Jrebel激活
激活前请确保已经安装好了Jrebel插件,本文通过反向代理激活. 第一步:下载激活工具(即代理工具),下载地址:https://github.com/ilanyu/ReverseProxy/relea ...
- Python小白学习之文件内建函数
文件内建函数: 2018-10-24 23:40:02 简单介绍: open()打开文件 read()读取文件(其实是输入文件里的内容到read函数,类似于get(url),所以下面的图片备注的是 ...
- Android 测试 之adb shell
一.发送键盘事件: 命令格式1:adb shell input keyevent "value" 其中value以及对应的key code如下表所列: KeyEvent Value ...
- @Resource和@Autowired的异同
相同点: 两者都能做到注入一个Bean. 两者都可应用在Field和Method上面. 两者均为Runtime级别的Retention. 不同点: 使用的场景有差异 @Resource可应用在类(TY ...
- 华为ensp使用
网络学习目录 AR是() Auto:自动线 copper:双绞线缆 serial:串行线 pos: 光纤 E1: ATM: CTL: STA: PC: MCS ...
- CSS3实现图片渐入效果
很多网站都有那种图片渐入的效果,如:http://www.mi.com/minote/,这种效果用css3和一些js实现起来特别简单. 拿我之前做的页面来说一下怎么利用css3来实现图片渐入效果. 下 ...
- 用VS测试程序
怀着一种忐忑的心情,我开始了我的软件测试. #include "stdio.h" #include "stdlib.h" int main(int argc, ...