当我导航到某个ViewController时,我希望从底部查看带有这样的选项的视图...
编辑1
我已经尝试使用表视图而不是集合视图来实现链接中的建议。这就是我所拥有的...
并向下拖动视图可得到此视图...
但是我进入视图,我不希望向上滑动视图覆盖视图的整个长度,但是它的大小应该与第一个屏幕截图中给出的大小相同。我该如何实现呢??
答案 0 :(得分:1)
假设您使用的是我在评论中发布的同一个github项目。
TDStickyView
奥特莱斯
@IBOutlet weak var viewLeft: UIView!
@IBOutlet weak var viewRight: UIView!
private var angel : CGFloat = 0
来自func viewSetup
:
:
// DELETE THESE 2 LINES AND THESE FUNC TOO.
self.setCursors()
self.rotateView(addAngel: 0)
来自handleGesture
if aNewOrigin.y <= 60 {
self.rotateView(addAngel: .pi/8)
}
else if aNewOrigin.y >= 60 && aNewOrigin.y < self.frame.height - 100 {
self.rotateView(addAngel: 0)
}
else {
self.rotateView(addAngel: -.pi/8)
}
在viewSetup
中进行更改
//topMostY = UIApplication.shared.statusBarFrame.height
topMostY = parentVC.view.center.y
// It is the top most Y position of tableview and it can't go above it. Change it according to your requirement.
在handleGesture
中进行更改
else if sender.state == .ended {
self.panGestureColView.isEnabled = false
if velocity.y > 0 {
// go down
// UIView.animate(withDuration: 0.3) {
// self.frame = CGRect(origin: CGPoint(x: 0, y: self.parentFrame.size.height - self.bottomMostY), size: self.frame.size)
// }
// Change above commented UIView.animate with below UIView.animate
UIView.animate(withDuration: 0.3, animations: {
self.frame = CGRect(origin: CGPoint(x: 0, y: self.parentFrame.size.height), size: self.frame.size)
}) { (isFin) in
self.removeFromSuperview()
}
}
else if velocity.y < 0 {
// go up
UIView.animate(withDuration: 0.3) {
self.frame = CGRect(origin: CGPoint(x: 0, y: self.topMostY), size: self.frame.size)
}
}
}
仅此而已。