runloop

fir.im Weekly

断了今生、忘了曾经 提交于 2019-11-29 14:28:33
最近 Swift 开源了,众开发者们欢呼雀跃。感谢开源,这是最好的时代。本期 fir.im Weekly 准备了一些关于 Swift 的“新鲜”干货分享,也包括一些优秀的 GitHub 源码、开发工具和技术文章等等。 Swift 开源了 美国西海岸时间,12月3日,Swift 开源了,可用于 iOS、OS X 和 Linux 平台。刚上 Github 短短 1 天,已经有近 1 万个 Star 。同时,苹果启用了新的官网: Swift.org ,Swift 的 GitHub 主页: https://github.com/apple/swift Swift 3 API 设计准则 勤快的 @星夜暮晨 翻译了苹果 Swift 官方网站博客的一篇文章: Swift 3 API Design Guidelines ,了解 Swift 3 特性,希望对你有所帮助。 Swift 第三方开发库 老外收藏的swift第三方开发库,点击 这里 可收藏。 仿知乎日报 iOS APP @路只要是对的 用 OC 写了一款仿知乎日报APP,第一次尝试用 MVVM 写APP,里面实现了知乎日报官方版的部分功能(有简单抽屉效果的实现原理), 源码见 这里 . 之前, @我偏笑_NSNirvana 花了将近一个月的时间用 Swift 2.0 精仿了知乎日报 iOS 端练手,注释相当详细,已抛出 Github 源码

Enqueue a selector to the run loop - is [NSObject performSelector:withObject:afterDelay:] the way to go?

最后都变了- 提交于 2019-11-29 06:43:16
I'd like to have a method be executed after the current method has passed and the UI has been updated. For that purpose, I'm using [object performSelector:@selector(someSelector) withObject:someObject afterDelay:0.0] right now. According to Apple's documentation , this creates a NSTimer which will then trigger and append the selector to the current NSRunLoop. But I don't consider this very elegant. Is there an easy way to directly enqueue the selector to the current run loop, without having Cocoa create a Timer etc.? Would performSelectorOnMainThread:withObject:waitUntilDone: (if I'm on the

Enqueue a selector to the run loop - is [NSObject performSelector:withObject:afterDelay:] the way to go?

让人想犯罪 __ 提交于 2019-11-28 00:01:42
问题 I'd like to have a method be executed after the current method has passed and the UI has been updated. For that purpose, I'm using [object performSelector:@selector(someSelector) withObject:someObject afterDelay:0.0] right now. According to Apple's documentation, this creates a NSTimer which will then trigger and append the selector to the current NSRunLoop. But I don't consider this very elegant. Is there an easy way to directly enqueue the selector to the current run loop, without having

Is NSTimer expected to fire when app is backgrounded?

老子叫甜甜 提交于 2019-11-26 20:37:35
I don't understand it at all but NSTimer in my app definitely is running in background. I have a NSLog in method run by the timer and it is logging while it's in background. It's on iPhone 4 with iOS 4.2.1. I have declared location background support in Info.plist. I read the docs and many discussions here and elsewhere and it shouldn't be possible. Is it an iOS bug? Or undocumented feature? I don't want to use it and find out in near future, for example with coming of iOS 4.3 that Apple silently "fixed" it and the app won't be working. Does anybody know more about it? NSTimer is going to fire

Is there a way to make drawRect work right NOW?

烂漫一生 提交于 2019-11-26 15:47:17
The original question............................................... If you are an advanced user of drawRect, you will know that of course drawRect will not actually run until "all processing is finished." setNeedsDisplay flags a view as invalidated and the OS, and basically waits until all processing is done. This can be infuriating in the common situation where you want to have: a view controller 1 starts some function 2 which incrementally 3 creates a more and more complicated artwork and 4 at each step, you setNeedsDisplay (wrong!) 5 until all the work is done 6 Of course, when you do the

Is there a way to make drawRect work right NOW?

不羁岁月 提交于 2019-11-26 04:36:46
问题 The original question............................................... If you are an advanced user of drawRect, you will know that of course drawRect will not actually run until \"all processing is finished.\" setNeedsDisplay flags a view as invalidated and the OS, and basically waits until all processing is done. This can be infuriating in the common situation where you want to have: a view controller 1 starts some function 2 which incrementally 3 creates a more and more complicated artwork