说好的坚持那

来源:互联网 发布:阿里云邮箱忘记密码 编辑:程序博客网 时间:2024/04/29 09:29

不好好学习真是一个纠结的状态,玩的时候很开心,可是有时候又觉得自己无所收获啊,反正深深地觉得自己不应该这样,好好学习吧,明日复明日,明日何其多,我生待明日

万事成蹉跎。其实学了写程序,深深地觉得怎样都要试一试的,可我又是觉得学习是循序渐进的事,不爱逼自己,不对,是放纵自己的啊,这几天大家都演示了自己的各个小组的星座,不管是美工还是代码,童鞋们反正各种让我惊呆了~~~有时候觉得不同相轻,但又不能说的很满,做的很好都会有很好的结果,我们班那个孩子美工真心好啊~~~其实我不喜欢老师一直说我们是做美工的,搞艺术的,肿么说,谈不上吧···反正都是写代码的了~~~~~~

NSTimer 是计数器的类,由它引出的NSRunLoop类还有NSInvocation类,其实我卡在这了,第一次接触,又要从无到有,好难,好难,看文档,哎呀,英文

先看NSTimer吧还是,毕竟是它牵出来的~~~~

常用的方法:

伟大文档上的解释

Scheduling Timers in Run Loops

A timer object can be registered in only one run loop at a time, although it can be added to multiple run loop modes within that run loop. There are three ways to create a timer:

  • Use thescheduledTimerWithTimeInterval:invocation:repeats: or scheduledTimerWithTimeInterval:target:selector:userInfo:repeats: class method to create the timer and schedule it on the current run loop in the default mode.
  • Use thetimerWithTimeInterval:invocation:repeats: or timerWithTimeInterval:target:selector:userInfo:repeats: class method to create the timer object without scheduling it on a run loop. (After creating it, you must add the timer to a run loop manually by calling theaddTimer:forMode: method of the corresponding NSRunLoop object.)
  • Allocate the timer and initialize it using theinitWithFireDate:interval:target:selector:userInfo:repeats: method. (After creating it, you must add the timer to a run loop manually by calling theaddTimer:forMode: method of the corresponding NSRunLoop object.)

Once scheduled on a run loop, the timer fires at the specified interval until it is invalidated. A non-repeating timer invalidates itself immediately after it fires. However, for a repeating timer, you must invalidate the timer object yourself by calling its invalidate method. Calling this method requests the removal of the timer from the current run loop; as a result, you should always call theinvalidate method from the same thread on which the timer was installed. Invalidating the timer immediately disables it so that it no longer affects the run loop. The run loop then removes and releases the timer, either just before theinvalidate method returns or at some later point. Once invalidated, timer objects cannot be reused.


  • + scheduledTimerWithTimeInterval:invocation:repeats;//一个类方法的啦,
  • + scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:
  • + timerWithTimeInterval:invocation:repeats:
  • + timerWithTimeInterval:target:selector:userInfo:repeats:
  • – initWithFireDate:interval:target:selector:userInfo:repeats:
同学们用的是第二个方法啊,

 myTimer = [NSTimerscheduledTimerWithTimeInterval:0.25 target:selfselector:@selector(changeImage)userInfo:nilrepeats:YES];

     //myTimer = [NSTimer timerWithTimeInterval:0.25 target:self selector:@selector(changeImage) userInfo:nil repeats:YES];

    //[[NSRunLoop mainRunLoop] addTimer:myTimer forMode:NSDefaultRunLoopMode];

下面两句和上面一句作用相同,我依然不知道invocation,似乎是一个NSInvocation (invocation:祈求,祈祷),是一个什么样子的类啊,又看到它是用

invocationWithMethodSignature初始化的,说还不能用alloc 和 init 


+ (NSInvocation *)invocationWithMethodSignature:(NSMethodSignature *)signature

又来个新的,NSMethodSignture啊,上帝啊,我看到一连串的不认识的,会恐慌的~~~~看文档,这个星期天天天读天天读吧~~~~没有发言权了,我不晓得~~~


老师今天讲的Apache 各种没听懂,小妞说用php也可以写后台,以前上网络科就困得要死,今天也不例外,网络啊,我还是先看看unix吧,我还是有一点喜欢操作系统的~~~~lallalllalalal~~~~~晚安~~~明天上海玩去啊~~~第一次大上海啊,大上海,大上海~~~~~~~哈哈哈哈


原创粉丝点击