[英]Calling view method on timer?
I have setup a view and I want to cycle the color of some text on that view using a timer. 我已经建立了一个视图,我想使用计时器来循环显示该视图上某些文本的颜色。 Is there a timer method for a view that gets called (or I can setup to get called) on a regular basis?
是否有用于定期调用(或可以设置调用)的视图的计时器方法?
You could use an NSTimer with the following method: 您可以通过以下方法使用NSTimer:
timerWithTimeInterval:target:selector:userInfo:repeats:
Look here for further information: 在这里查看更多信息:
http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html#//apple_ref/occ/clm/NSTimer/timerWithTimeInterval:target:selector:userInfo:repeats : http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html#//apple_ref/occ/clm/NSTimer/timerWithTimeInterval:target:selector:userInfo:重复 :
NSTimer
will work for you as long as you don't require "fine" precision -- like sub-100ms. 只要您不需要“精细”精度(如100ms以下),
NSTimer
就会为您工作。
Core Animation may work here as well. 核心动画也可以在这里工作。 Are you animating a UILabel or are you rendering the text directly into the view with Core Graphics calls (or OpenGL)?
您是要对UILabel进行动画处理,还是要通过Core Graphics调用(或OpenGL)将文本直接呈现到视图中?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.