我正在使用名为SAConfettiView的Swift库:https://github.com/sudeepag/SAConfettiView
我想在视图层次结构的顶部添加一个'confettiView',这样它就不会被其他任何东西阻挡,但我仍然希望UIButton,UITableViewCell等可以选择,我怎么能在代码中做到这一点?
以下是我目前使用的代码:
override func viewDidLayoutSubviews() {
// Create confetti view
confettiView = SAConfettiView(frame: self.view.bounds)
// Set colors (default colors are red, green and blue)
confettiView.colors = [UIColor(red:0.95, green:0.40, blue:0.27, alpha:1.0),
UIColor(red:1.00, green:0.78, blue:0.36, alpha:1.0),
UIColor(red:0.48, green:0.78, blue:0.64, alpha:1.0),
UIColor(red:0.30, green:0.76, blue:0.85, alpha:1.0),
UIColor(red:0.58, green:0.39, blue:0.55, alpha:1.0)]
// Set intensity (from 0 - 1, default intensity is 0.5)
confettiView.intensity = 1
// Set type
confettiView.type = .Diamond
// For custom image
// confettiView.type = .Image(UIImage(named: "diamond")!)
// Add subview
view.addSubview(confettiView)
confettiView.startConfetti()
}
答案 0 :(得分:1)
不检查第三方代码,但如果编写得当,您至少可以使用“UIView.bringSubview(ToFront:UIView)”。
当然,如果五彩纸屑真正 位于您的层次结构的顶部,那么它就是 - 意思是不阻碍。