我想创建完全相同的滑动按钮,如https://github.com/shadowfaxtech/proSwipeButton。我想知道如何改变用户触摸按钮的箭头
我这么做是为了获得刷卡行动。
let rightSwipe = UISwipeGestureRecognizer(target: self, action: #selector(handleSwipes(_:)))
rightSwipe.direction = .right
view.addGestureRecognizer(rightSwipe)
字符串
但问题是如何添加箭头到按钮,改变有用户触摸的位置。
2条答案
按热度按时间oipij1gg1#
下面是我写的用于在按钮上滑动的代码。将图像指定给图像视图。
字符串
的数据
完整的项目在github上:https://github.com/IamSaurav/SwipeButton
twh00eeo2#
嗯,像这样的怎么样?您可以在swipeImage var的故事板中添加UIImage。如果图像与文本颜色相同,则效果最佳。
导入UIKit
字符串
您从UILabel开始,如果需要,可以将其更改为使用自动布局。