做了一个倒计时的例子,找函数照的我挺辛苦,嘿嘿,新手嘛。。
给大家分享了
mScheduleTimer = NSTimer.CreateRepeatingScheduledTimer (1, (t) => {
if(count!=0)
{
count=count-1;
YZMB.SetTitle (count.ToString (), UIControlState.Normal);
}
else
{
YZMB.SetTitle ("获取验证码", UIControlState.Normal);
YZMB.BackgroundColor = UIColor.FromRGB(54,137,246);
stop();
}
});
private void stop()
{
mScheduleTimer.Invalidate ();//不停止懂话会一直执行,且占用内存!
count = 60;
}