我是Swift的新手,所以无法解决问题,请指导我
使用它像
UIView.animateWithDuration(duration, delay: 0.0, options: option, animations: { () -> Void in
self.btnCallButton.hidden = true
}, completion: nil)
并显示以下错误
Cannot invoke 'animateWithDuration' with an argument list of type '(Float, delay: FloatLiteralConvertible, options: UIViewAnimationOptions, animations: () -> Void, completion: NilLiteralConvertible)'
请提供所需的建议,并提供一些描述swift
中的块的链接答案 0 :(得分:0)
隐藏在Swift中无法动画。如果您想通过淡入/淡出来隐藏/显示,请使用以下代码进行淡出
UIView.animateWithDuration(duration, delay: 0.0, options:
options, animations: {
self.btnCallButton.hidden = false
self.btnCallButton.alpha = 0.0
}, completion: { finished in
self.btnCallButton.hidden = true
})
并关注fadein
UIView.animateWithDuration(duration, delay: 0.0, options:
options, animations: {
self.btnCallButton.hidden = false
self.btnCallButton.alpha = 1.0
}, completion: { finished in
})
答案 1 :(得分:0)
在结束时添加return
为
UIView.animateWithDuration(duration, delay: 0.0, options: option, animations: { () -> Void in
self.btnCallButton.hidden = true
return;
}, completion: nil)
答案 2 :(得分:0)
像这样:
public delegate void InvokeDelegate();
new Thread(delegate ()
{
while (!DL.HasExited)
{
Thread.Sleep(500);
}
File.Delete(folderBrowserDialog1.SelectedPath + @"\Steam\steamcmd.zip");
//The code below this note is the problem
button1.BeginInvoke(new InvokeDelegate(InvokeMethod));
}).Start();
public void InvokeMethod()
{
button1.Text = "START DOWNLOADING";
button1.Enabled = true;
}