画倒计时圈 [英] Draw countdown circles

查看:107
本文介绍了画倒计时圈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ViewController中绘制一个如下图所示的倒计时:





不幸的是,我对如何实现这一目标一无所知。如果有人可以给我一个线索,我会很高兴。



干杯。



西里尔

解决方案

一个简单的想法,我不想使用任何iOS框架来绘制它:),只需使用小的 UIWebView 并运行javascript(仅在用户启用javascript的情况下有效,但是嘿,我还没有看到谁不使用javascript)。



Javascript极地时间可以在互联网,开源之类的

上找到,



http://oneorangesoftware.com/polartimer/



更改和编辑一点,然后就可以了!太棒了!



干杯!



如果您不喜欢上面的方法,可以看看这段代码,



http://www.herbert-siojo.com/2011/04/19/drawing-a-countdown-timer-ios/



精心制作,但要获得与您相同的外观,您可能需要进行一些调整!



请注意代码中的这一行,

  [self performSelector:@selector(cancelPie :) withObject:timer afterDelay:sliderIntervalDelay.value]; 

只需更改为

  [self performSelector:@selector(cancelPie :) withObject:timer afterDelay:60.0]; 

信用:转到将其代码发布在 http://www.herbert-siojo.com/2011 / 04/19 / drawing-a-countdown-timer-ios /


I would like to draw, in a ViewController, a countdown like in the following image:

Unfortunately, I don't have any idea on how to realize this. I will be please if someone could give me a clue on this.

Cheers.

Cyril

解决方案

A quick thought, I would not like to draw it by using any iOS frameworks :), Just use small UIWebView and run javascript(Only works if user enables javascript, but hey I have seen no one yet who doesn't use javascript).

Javascript polar time can be found on internet, open source like,

http://oneorangesoftware.com/polartimer/

change and edit a bit and off you go! Awesome time!

Cheers!

If you don't like above approach than you may look into this code,

http://www.herbert-siojo.com/2011/04/19/drawing-a-countdown-timer-ios/

nicely crafted however to achieve same look as yours you may have to tweak a bit!

Beware of this line in code,

[self performSelector:@selector(cancelPie:) withObject:timer afterDelay:sliderIntervalDelay.value];

just change to,

[self performSelector:@selector(cancelPie:) withObject:timer afterDelay:60.0];

Credit : Goes to a developer who posted their code on http://www.herbert-siojo.com/2011/04/19/drawing-a-countdown-timer-ios/.

这篇关于画倒计时圈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆