iPhone开发--NSTimer开启和关闭

NSTimer开启
[cpp]  view plain copy
  1. timer=[NSTimer scheduledTimerWithTimeInterval:0.06f   
  2.                                        target:self   
  3.                                      selector:@selector(getFunction)   
  4.                                      userInfo:nil   
  5.                                       repeats:YES];   

NSTimer关闭
[cpp]  view plain copy
  1. if ([timer isValid]) {  
  2.         [timer invalidate];  
  3. }  

你可能感兴趣的:(iPhone开发--NSTimer开启和关闭)