作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的看法如下
彩色图 block 基本上是 View 。当我长按平铺 View 时,我正在创建长按的平铺 View 的副本。此外,当长按时,应该会出现如下图所示的 View 。
掉落区域应该从底部升起,或者应该从屏幕底部的昆虫开始生长。
当长按平铺 View 时,我正在创建 View 的副本,并且能够成功复制并拖动到屏幕上,但我一直停留在创建此放置区域及其动画上。
有人可以指导我如何实现这个......
提前致谢...
最佳答案
let dropView = UIView(frame: CGRect(x:0, y:0, width:300, height:100))
dropView.frame.origin = CGPoint(x: 0, y: self.view.frame.size.height)
dropView.center = CGPoint(x:self.view.frame.size.width/2, y:dropView.center.y)
dropView.backgroundColor = UIColor.blue
self.view.addSubview(dropView)
当您想要使其显示动画时,请使用以下命令:
UIView.animate(withDuration: 0.5, delay: 0.0, options: [.repeat, .curveEaseOut, .autoreverse], animations: {
dropView.frame.origin = CGPoint(x:dropView.frame.origin.x, y:dropView.frame.origin.y - dropView.frame.size.width - 10)
}, completion: nil)
关于ios - 如何在父 View 上显示不断增长的 subview ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45482042/
我是一名优秀的程序员,十分优秀!