cadisplaylink

UIScrollView broken and halts scrolling with OpenGL rendering (related CADisplayLink, NSRunLoop)

你说的曾经没有我的故事 提交于 2019-11-30 22:54:36
Solution note, Not a question. UIScrollView suspends OpenGL rendering by preventing firing CADisplayLink tick when CADisplayLink registered with NSDefaultRunLoopMode . But, if you use NSRunLoopCommonModes to solve this, UIScrollView will halt scrolling at burst scrolling. And after once halted, it does not scroll again. (broken) And registering CADisplayLink in other thread/runloop (as described in answer of this question: CADisplayLink stops updating when UIScrollView scrolled ) reduces UIScrollView behavior breaking, but cannot eliminate. Josh Rosen Edit: Woops, misread your post. Nevermind

How many ways to calculate the FPS (Frames per second) of an iOS App programmatically?

大城市里の小女人 提交于 2019-11-30 21:42:39
Since we are talking about programmatically , Instruments are not under my consideration. Some reference listed in advance: Calculate fps (frames per second) for iphone app Display FPS on iOS onscreen (without Instruments) At what framerate does the iOS UI run animations at? 1. Using CADisplayLink According to the doc, The duration property provides the amount of time between frames. You can use this value in your application to calculate the frame rate of the display... So in my demo project, I add a displayLink to mainRunLoop for UITrackingRunLoopMode: self.displayLink = [CADisplayLink

Why does UIScrollView pause my CADisplayLink?

有些话、适合烂在心里 提交于 2019-11-30 17:40:43
I have a view backed by a CAEAGLLayer, which is inside a UIScrollView. When I begin scrolling, the CADisplayLink that calls the -draw method of openGL view stops getting called. I verified that my runloop start / stop methods don't get called when scrolling. The -draw method simply doesn't get called as soon as scrolling begins, and resumes getting called as soon as scrolling ends. Does UIKit stop a CADisplayLink from firing as soon as scrolling starts? The display link is added to the run loop like this: [dl addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; Maybe there is

Correct handling / cleanup / etc of CADisplayLink in Swift custom animation?

别等时光非礼了梦想. 提交于 2019-11-30 08:12:12
Consider this trivial sync animation using CADisplayLink , var link:CADisplayLink? var startTime:Double = 0.0 let animTime:Double = 0.2 let animMaxVal:CGFloat = 0.4 private func yourAnim() { if ( link != nil ) { link!.paused = true //A: link!.removeFromRunLoop( NSRunLoop.mainRunLoop(), forMode:NSDefaultRunLoopMode) link = nil } link = CADisplayLink(target: self, selector: #selector(doorStep) ) startTime = CACurrentMediaTime() link!.addToRunLoop( NSRunLoop.currentRunLoop(), forMode:NSDefaultRunLoopMode) } func doorStep() { let elapsed = CACurrentMediaTime() - startTime var ping = elapsed if

How many ways to calculate the FPS (Frames per second) of an iOS App programmatically?

落爺英雄遲暮 提交于 2019-11-30 05:38:04
问题 Since we are talking about programmatically , Instruments are not under my consideration. Some reference listed in advance: Calculate fps (frames per second) for iphone app Display FPS on iOS onscreen (without Instruments) At what framerate does the iOS UI run animations at? 1. Using CADisplayLink According to the doc, The duration property provides the amount of time between frames. You can use this value in your application to calculate the frame rate of the display... So in my demo project

Why does UIScrollView pause my CADisplayLink?

浪尽此生 提交于 2019-11-30 02:00:37
问题 I have a view backed by a CAEAGLLayer, which is inside a UIScrollView. When I begin scrolling, the CADisplayLink that calls the -draw method of openGL view stops getting called. I verified that my runloop start / stop methods don't get called when scrolling. The -draw method simply doesn't get called as soon as scrolling begins, and resumes getting called as soon as scrolling ends. Does UIKit stop a CADisplayLink from firing as soon as scrolling starts? The display link is added to the run

Format realtime stopwatch timer to the hundredth using Swift

前提是你 提交于 2019-11-28 13:46:22
I have an app using an NSTimer at centisecond (0.01 second) update intervals to display a running stopwatch in String Format as 00:00.00 (mm:ss.SS). (Basically cloning the iOS built-in stopwatch to integrate into realtime sports timing math problems, possibly needing millisecond accuracy in the future) I use (misuse?) the NSTimer to force-update the UILabel. If the user presses Start, this is the NSTimer code used to start repeating the function: displayOnlyTimer = NSTimer.scheduledTimerWithTimeInterval(0.01, target: self, selector: Selector("display"), userInfo: nil, repeats: true) And here

Format realtime stopwatch timer to the hundredth using Swift

懵懂的女人 提交于 2019-11-27 07:57:54
问题 I have an app using an NSTimer at centisecond (0.01 second) update intervals to display a running stopwatch in String Format as 00:00.00 (mm:ss.SS). (Basically cloning the iOS built-in stopwatch to integrate into realtime sports timing math problems, possibly needing millisecond accuracy in the future) I use (misuse?) the NSTimer to force-update the UILabel. If the user presses Start, this is the NSTimer code used to start repeating the function: displayOnlyTimer = NSTimer