iOS: UIScrollView pauses NSTimer while scrolling
StackOverflow http://stackoverflow.com/a/7059499
Question:I have a UIScrollView that has a series of labels which are rapidly updating numbers (every .06 seconds). While the scroll view is moving, however, the NSTimer is paused and does not continue until after the scrolling and the elastic animation have finished.
How can I avoid this and have the NSTimer run regardless of the state of the scroll view?
Anwser:An easy way to fix this is adding your NSTimer to the mainRunLoop.
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
To remove a timer from all run loop modes on which it is installed, send an invalidate message to the timer.
iOS: UIScrollView pauses NSTimer while scrolling的更多相关文章
- iOS 中的 NSTimer
iOS 中的 NSTimer NSTimer fire 我们先用 NSTimer 来做个简单的计时器,每隔5秒钟在控制台输出 Fire .比较想当然的做法是这样的: @interface Detail ...
- IOS UIScrollView常用代理方法
iOS UIScrollView代理方法有很多,从头文件中找出来学习一下 //只要滚动了就会触发 - (void)scrollViewDidScroll:(UIScrollView *)scrollV ...
- iOS - UIScrollView
前言 NS_CLASS_AVAILABLE_IOS(2_0) @interface UIScrollView : UIView <NSCoding> @available(iOS 2.0, ...
- IOS UIScrollView + UIButton 实现segemet页面和顶部标签页水平滚动效果
很长一段时间没有写博客了,最近在学习iOS开发,看了不少的代码,自己用UIScrollView和UIButton实现了水平滚动的效果,有点类似于今日头条的主界面框架,效果如下: 代码如下: MyScr ...
- iOS开发之NSTimer使用初探
创建一个定时器(NSTimer) - (void)viewDidLoad { [super viewDidLoad]; [NSTimer scheduledTimerWithTimeInterval: ...
- iOS中的NSTimer 和 Android 中的Timer
首先看iOS的, Scheduling Timers in Run Loops A timer object can be registered in only one run loop at a t ...
- iOS - CADisplayLink与NSTimer
一.CADisplayLink简介 CADisplayLink 是一个定时器对象可以让你的应用以与显示器的刷新界面相同的频率进行绘图. 应用如果想要创建 display link ,需要提供一个目标对 ...
- IOS中的NSTimer定时器详解
/* 在IOS中有多种定时器,这里我对NSTimer定时器做了一个简单的介绍.如果你是小白,你可能会从这篇文章中学习到一些知识,如果你是大牛,请别吝啬你的评论,指出我的不足,你的质疑是对我最大的帮助. ...
- iOS UIScrollView 你可能不知道的奇技淫巧
iOS 的 UIScrollView 可以说是十分强大,巧妙地运用它可以得到一些意想不到的效果.本文将举几个 ScrollView 不常见运用的例子. 自带信息应用 这个界面既可以上下卷动,也可以左右 ...
随机推荐
- Lintcode:Longest Common Subsequence 解题报告
Longest Common Subsequence 原题链接:http://lintcode.com/zh-cn/problem/longest-common-subsequence/ Given ...
- hdu1198(模拟搜索)
这个题目,比较恶心,思路很是简单,就是模拟的时候有些麻烦......水题 #include<iostream> #include<cstdio> #include<cst ...
- java结合js获取验证码
框架springmvc 1.后台java代码: package com.fh.controller.system.secCode; import java.awt.Color; import java ...
- [转]ExtJS3.0与KindEditor4.1.2整合
原文地址:http://blog.csdn.net/resigshy/article/details/7937021 ExtJS与KindEditor整合的方式. /** * 将KindEditor4 ...
- [转]MYSQL 与 Oracle 之间的数据类型转换
原文地址:http://www.cnblogs.com/guyueyanzi/archive/2010/02/27/1674788.html Table 2-4 Default Data Type M ...
- open source Swift, Objective-C and the next 20 years of development
Q&AApple's Craig Federighi talks open source Swift, Objective-C and the next 20 years of develop ...
- [转]Java中的JavaBean类
一. javabean 是什么? Bean的中文含义是"豆子",顾名思义,JavaBean是指一段特殊的Java类, 就是有默然构造方法,只有get,set的方法的java类的对象 ...
- JBoss Wildfly (1) —— 7.2.0.Final编译
JBoss Wildfly (1) -- 7.2.0.Final编译 wildfly版本: 7.2.0.Final-testsuite-fix jdk版本: jdk1.7.0_79 maven版本: ...
- ListView 多行拖拽排序
核心代码:修改ListView的属性,及绑定事件 // 初始化listView1. private void InitializeListView() { listView1.AllowDrop = ...
- javascript 完美解决对联广告
javascript 完美解决对联广告 // function couplet(){ if(arguments.length>=1) this.objID = document.getEleme ...