国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

swift 拖動view代碼

2019-11-08 19:52:31
字體:
來源:轉載
供稿:網友

將一個View拖動到SB,創建一個redView繼承自UIView,

//// RedView.swift// DragView//// Created by luoriver on 2017/2/15.// Copyright ? 2017年 SocererGroup. All rights reserved.//import UIKitclass RedView: UIView { /* // Only override draw() if you perform custom drawing. // An empty implementation adversely affects performance during animation. override func draw(_ rect: CGRect) { // Drawing code } */ override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) { //獲取手指 let touch = (touches as NSSet).anyObject() as! UITouch let nowLocation = touch.location(in: self) let PReLocation = touch.previousLocation(in: self) //獲取兩個手指的偏移量 let offsetX = nowLocation.x - preLocation.x let offsetY = nowLocation.y - preLocation.y var center = self.center center.x += offsetX center.y += offsetY self.center = center }}
上一篇:map與set

下一篇:GDOI2017模擬2.15

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鄂伦春自治旗| 张家口市| 墨玉县| 安顺市| 迁安市| 涞源县| 扎赉特旗| 沁源县| 香港| 吴桥县| 汝阳县| 洪江市| 丹凤县| 裕民县| 山丹县| 沽源县| 阿尔山市| 阿克苏市| 双城市| 武宁县| 桓台县| 新丰县| 德州市| 固镇县| 武川县| 恭城| 太和县| 台东市| 成武县| 桦甸市| 山丹县| 武宣县| 高清| 赣州市| 三亚市| 南丹县| 吉林市| 宣汉县| 鹰潭市| 奉节县| 淮北市|