实现思路:1、创建一个UIScrollView,这里设置为宽度300,高度130,通过storyboard创建;2、使用代码在UIScrollView中添加ImageView,横向放入多张ImageView;3、设置UIScrollView的contentSize为所有图片的宽度总和;4、要保证UI...
分类:
其他好文 时间:
2015-01-01 06:39:44
阅读次数:
228
1. NSRunLoopCommonModes和Timer 当使用NSTimer的scheduledTimerWithTimeInterval方法时。事实上此时Timer会被加入到当前线程的Run Loop中,且模式是默认的NSDefaultRunLoopMode。而如果当前线程就是主线程,也就是U...
分类:
其他好文 时间:
2014-12-31 15:56:43
阅读次数:
209
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:100 target:self selector:@selector(timerFireMethod:) userInfo:nil repeats:YES];
分类:
移动开发 时间:
2014-12-30 16:42:32
阅读次数:
239
源地址:http://fann.im/blog/2013/09/20/nsurlconnection-in-scrolling/实际开发中用了 AFN 等是不会遇到这个问题。当然也可以作为原理理解。首先是 NSRunLoop,我的理解 runloop 就是 iOS 的消息循环处理机制,响应处理各种消...
分类:
移动开发 时间:
2014-12-28 01:39:20
阅读次数:
170
发现iOS封装的有点恶心,把select封装成了CFRunLoop的形式,又把CFRunLoop封装成了NSRunLoop,跟select使用方式又一样了。 又弄一些玄之又玄的概念,AF_UNIX封装成了NSPort。项目中遇到了需要异步解析dns的问题,需要解析dns的时候,另一个线程去取消它,但...
分类:
移动开发 时间:
2014-12-27 20:24:04
阅读次数:
186
//每隔一秒改变一次颜色
[NSTimer
scheduledTimerWithTimeInterval:1
target:self
selector:@selector(changeColor)
userInfo:nil
repeats:YES];
#pragma mark 改变颜色
- (void)changeColo...
分类:
其他好文 时间:
2014-12-26 14:39:04
阅读次数:
120
原文转自 :http://www.codecate.com/code/?p=77最近开发遇到NSTimer Target 造成循环引用问题,不释放,以下是解决方案。stackoverflow上的一个解决方案http://stackoverflow.com/questions/16821736/wea...
分类:
移动开发 时间:
2014-12-25 01:24:58
阅读次数:
334
在写程序的过程中用到很多提示的信息,于是非常自然地就要使用UIAlertView控件。但是这些提示的信息有时候只需提示就行,不用操作,那么此时就要这个提示框自动消失就OK了。 UIAlertView弹出后2s让其自动消失,两种方法: (1)结合NSTimer
定义UIAlertView *baseAlert;
- (void) performDismiss: (NSTimer *)...
分类:
移动开发 时间:
2014-12-23 19:32:50
阅读次数:
184
倒计时在viewDidLoad里写个定时器 [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerFireMethod:) userInfo:nil repeats:YES];然后声明定时器的方...
分类:
移动开发 时间:
2014-12-22 21:17:32
阅读次数:
234
使用NSTimer scheduledTimerWithTimeInterval: target: selector:userInfo: repeats: 的时候有两个地方需要注意 。首先selector指定的方法必须是带一个参数的方法,并且那个参数的类型是NSTimer *。其次,参数是靠NSTi...
分类:
移动开发 时间:
2014-12-11 01:30:09
阅读次数:
230