C# Xamarin iOS ProgressView未更改
我想实现一个UIProgressView,它在8秒内从0加载到100,但它不起作用 这是我的密码。ProgressView应用程序是正确的,但它不会自行更新它们。什么是我的错C# Xamarin iOS ProgressView未更改,c#,ios,xamarin,C#,Ios,Xamarin,我想实现一个UIProgressView,它在8秒内从0加载到100,但它不起作用 这是我的密码。ProgressView应用程序是正确的,但它不会自行更新它们。什么是我的错 public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); Timer = NSTimer.CreateRepeatingScheduledTimer(TimeSpan.From
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
Timer = NSTimer.CreateRepeatingScheduledTimer(TimeSpan.FromSeconds(15.0), delegate
{
DismissViewController(true, null);
});
UIView.Animate(8, () => {
progressView.SetProgress(1.0f, true);
});
}
它应该能工作,我已经亲自测试了你的代码。只需确保progresbar的初始值设置为零:
progresView.Progress = 0f;
或在界面生成器/设计器中:
我用下面的方法来做你想做的事情 将进度设置为0
progressView.Progress = 0.0f;
使用带有延迟和动画选项的动画功能
UIView.Animate (8, 0, UIViewAnimationOptions.CurveLinear,
() => {
progressView.SetProgress(1.0f, true);
},
() => {
// animation complete action,
// instead of doing the delay above your animation just navigate away in here.
}
);
我希望这有帮助。干杯。如果您在
progressView.SetProgress
行上设置断点,则您的ui视图.动画代码是正确的。是否调用它?