gpt4 book ai didi

ios - UIView 不是第一次消除

转载 作者:行者123 更新时间:2023-11-29 01:55:59 24 4
gpt4 key购买 nike

我正在尝试在单击按钮时为 UIView 制作动画。它确实会在第一次点击时出现,但只有在那之后才会出现。

@IBAction func viewDetails(sender: AnyObject) {

UIView.animateWithDuration(0.5 as NSTimeInterval, animations: {
println(self.viewDetailsView.center.x)
println(self.viewDetailsView.hidden)
self.viewDetailsView.hidden = false
self.viewDetailsView.center = CGPointMake(self.viewDetailsView.center.x - 4000, self.viewDetailsView.center.y)
self.view.layoutIfNeeded()
}, completion: {
finished in
self.detailsVisible = true
}) }

最佳答案

试试这个:

@IBAction func viewDetails(sender: AnyObject) {

println(self.viewDetailsView.center.x)
println(self.viewDetailsView.hidden)
self.viewDetailsView.hidden = false
self.viewDetailsView.center = CGPointMake(self.viewDetailsView.center.x - 4000, self.viewDetailsView.center.y)

UIView.animateWithDuration(0.5 as NSTimeInterval, animations: {

self.view.layoutIfNeeded()
}, completion: { finished in
self.detailsVisible = true
})
}

关于ios - UIView 不是第一次消除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30840570/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com