UIViewanimation定时器

所以有一个UITextField ,我有字段的限制。 如果用户试图input更大的东西, UIView出现。 我已经有这部分animation。 这是我有什么:

 public void animateHoursMesg() { var HoursMesgExpandPos = new PointF (248.0f, 273.0f); var HoursMesgInitPos = new PointF (400.0f, 273.0f); UIView.Animate ( duration: 0.3f, delay: 0, options: UIViewAnimationOptions.CurveEaseInOut, animation: () => { if (Flag_HoursMesg) { view_HoursLimitMesg.Center = HoursMesgInitPos; Flag_HoursMesg = false; } else { view_HoursLimitMesg.Center = HoursMesgExpandPos; Flag_HoursMesg = true; } }, completion: () => { } ); } 

问题是我希望这个视图在出现5秒钟后动起来。

有人可以帮我这个吗?

感谢您的时间。

在animate方法的完成块中,使用NSTimer来安排一个块,然后执行5秒。

 [NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(animateAway) userInfo:nil repeats:NO]; 

然后,为animateAway创build另一个方法,以反转以前的animation。

在animation的完成块中,您可以运行不同的animation以5秒的延迟对视图进行animation处理。