在写oc代码时的注意有一些错误看看各位朋友在平常注意了编写是的小错误我也会不断总结的1.[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timesAction:)userInfo:nil repeats...
分类:
移动开发 时间:
2015-09-19 21:03:25
阅读次数:
129
在iOS中有很多地方需要用到定时器的,例如我们经常看到的图片轮播器,当你打开页面的时候它是自动进行轮播,这便是用到了定时器,那么定时器又是如何添加的呢?下面就给大家用一小段代码来演示一下:首先要添加一个定时器:- (void)addTimer{ //添加一个定时器 [NSTimer sch...
分类:
其他好文 时间:
2015-09-18 21:40:22
阅读次数:
138
/** 添加定时器 */@property (nonatomic, strong) NSTimer *timer;- (void)addTimer{ // 2秒后,自己 调用nextImage方法 nil 一直循环这个定时器 self.timer = [NSTimer scheduled...
分类:
其他好文 时间:
2015-09-15 19:43:21
阅读次数:
211
创建一个 Timer+scheduledTimerWithTimeInterval: invocation: repeats:+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocatio....
分类:
其他好文 时间:
2015-09-14 22:39:18
阅读次数:
165
1.创建NSTimer *_timer;2.使用_timer = [NSTimer scheduledTimerWithTimeInterval:0.5f target:self selector:@selector(nextTime) userInfo:nil repeats:YES]; [[NS...
分类:
其他好文 时间:
2015-09-13 19:51:42
阅读次数:
213
NSTimer使用注意点及总结总结以下在NSTimer的使用中遇到的一些问题:1. 不要在dealloc函数中停止并释放NSTimer如果这样做,会导致对象永远无法调用dealloc函数,也就是会造成内存泄漏。一个比较合理的解释是NSTimer的回调方法具有retain属性,所以不停止它的情况下被引...
分类:
移动开发 时间:
2015-09-10 23:47:12
阅读次数:
333
#import "ViewController.h"@interface ViewController ()@property (nonatomic,strong) NSTimer *timer;@property (nonatomic,strong) NSTimer *mouseTimer;@pr...
分类:
其他好文 时间:
2015-09-10 20:50:13
阅读次数:
211
无限轮播(功能完善)一、自动滚动添加并设置一个定时器,每个2.0秒,就跳转到下一条。 获取当前正在展示的位置。 1 [self addNSTimer]; 2 } 3 4 -(void)addNSTimer 5 { 6 // NSTimer timerWithTimeInterval...
分类:
其他好文 时间:
2015-09-10 12:41:39
阅读次数:
166
iPhone应用开发中关于NSRunLoop的概述是本文要介绍的内容,NSRunLoop是一种更加高明的消息处理模式,他就高明在对消息处理过程进行了更好的抽象和封装,这样才能是的你不用处理一些很琐碎很低层次的具体消息的处理,在NSRunLoop中每一个消息就被打包在input source或者是ti...
分类:
其他好文 时间:
2015-09-08 15:10:05
阅读次数:
229
1.NSRunLoop是IOS消息机制的处理模式NSRunLoop的主要作用:控制NSRunLoop里面线程的执行和休眠,在有事情做的时候使当前NSRunLoop控制的线程工作,没有事情做让当前NSRunLoop的控制的线程休眠。2.NSRunLoop 就是一直在循环检测,从线程start到线程en...
分类:
其他好文 时间:
2015-09-08 15:05:59
阅读次数:
185