当视图尺寸较小时,如何使缩放比例更加舒适?

问题描述

我正在开发一个允许用户向图像添加文本并通过UIGestureRecognizers调整其大小的应用程序。在文本视图中添加短文本时,用两根手指抓住该视图变得越来越困难。当第二根手指不在视线范围内时,怎么处理?

func setupGestures(for view: UITextView) {
    //add pan gesture
    let gestureRecognizer = UIPanGestureRecognizer(target: self,action: #selector(handlePan))
    gestureRecognizer.delegate = self
    view.addGestureRecognizer(gestureRecognizer)
    view.isMultipleTouchEnabled = true
    view.isEditable = false
    //add pinch gesture
    let pinchGesture = UIPinchGestureRecognizer(target: self,action:#selector(pinchRecognized(pinch:)))
    pinchGesture.delegate = self
    view.addGestureRecognizer(pinchGesture)
    //add rotate gesture.
    let rotate = UIRotationGestureRecognizer.init(target: self,action: #selector(handleRotate(recognizer:)))
    rotate.delegate = self
    view.addGestureRecognizer(rotate)
}

这是捏选择器

@objc func pinchRecognized(pinch: UIPinchGestureRecognizer) {
    if let view = pinch.view {
        view.transform = view.transform.scaledBy(x: pinch.scale,y: pinch.scale)
        pinch.scale = 1
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...