cocoa

iOS开发——Block内存管理实例分析

大兔子大兔子 提交于 2020-05-09 17:41:04
说道block大家都不陌生,内存管理问题也是开发者最头疼的问题,网上很多讲block的博客,但大都是理论性多点,今天结合一些实例来讲解下。 存储域 首先和大家聊聊block的存储域,根据block在内存中的位置,block被分为三种类型: NSGlobalBlock NSStackBlock NSMallocBlock 从字面意思上大家也可以看出来 1、 NSGlobalBlock 是位于全局区的block,它是设置在程序的数据区域(.data区)中。 2、 NSStackBlock 是位于栈区,超出变量作用域,栈上的Block以及 ____block__变量都被销毁。 3、 NSMallocBlock 是位于堆区,在变量作用域结束时不受影响。 注意:在 ARC 开启的情况下,将只会有 NSConcreteGlobalBlock 和 NSConcreteMallocBlock 类型的 block。 作为一个开发者,有一个学习的氛围跟一个交流圈子特别重要,这是一个我的iOS交流群: 413038000 ,不管你是小白还是大牛欢迎入驻 ,分享BAT,阿里面试题、面试经验,讨论技术, 大家一起交流学习成长! 推荐阅读: iOS开发——2020 最新 BAT面试题合集(持续更新中) 说了这么多理论的东西,有些人可能很懵,觉得讲这些有什么用呢,我平时使用block并没有什么问题啊,好了

200道iOS面试题面试题整理,底层、技术亮点公司需要的这里都有

瘦欲@ 提交于 2020-05-08 17:21:47
100家知名企业今年来iOS面试题合集: 你要的这里都有; 企业要的这里也有; 从基础开始到进阶、深入底层 整理出188个面试题,全是干货 目录展示: 1、swift和oc的区别 2、编译链接 3、synthesize & denamic 4、在项目开发中常用的开发工具有哪些? 5、UITableView & UICollection 6、NSProxy & NSObject 7、Object & Swift 8、传值通知 & 推送通知(本地&远程) 9、第三方库 & 第三方平台 10、NSCache & NSDcitionary 11、 UIView的setNeedsDisplay和setNeedsLayout方法 12、UILayer & UIView 13、layoutSubViews & drawRects 14、UDID & UUID 15、CPU & GPU 16、点(pt)& 像素(px) 17、属性与成员变量 18、int和NSInteger的区别 (1)import和include (2)@class (3)全局 & 静态变量 19、类和对象 (1)分类拓展协议中哪些可以声明属性? (2)继承和类别的区别 (3)分类的作用 (4)分类的局限性 20、category & extension 21、Foundation (1)字符串 (2)字符串截取 (3)格式

How can I skip code signing for development builds in Xcode?

浪尽此生 提交于 2020-05-07 10:57:48
问题 Whenever I build my Xcode project, after compiling all my code, it takes forever to finish "signing product." (I believe it's because the project includes about 200 MB of resources that need signing.) I would like to skip the code signing during development, so the build can finish faster. How can I do this? 回答1: To turn the code signing off, go to your project and target "Build Settings", search for "Code Signing Identity" change its value to "Don't Code Sign" in both of them. To make this

White Border around Resized Image

不打扰是莪最后的温柔 提交于 2020-04-30 09:07:11
问题 I'm using the following code to resize an image.But i keep getting a white border at the bottom func resize(withSize targetSize: NSSize) -> NSImage? { let size=NSSize(width: floor((targetSize.width/(NSScreen.main?.backingScaleFactor)!)), height:floor( (targetSize.height/(NSScreen.main?.backingScaleFactor)!))) let frame = NSRect(x: 0, y: 0, width: floor(size.width), height: floor(size.height)) guard let representation = self.bestRepresentation(for: frame, context: nil,hints: nil) else { return

CMSampleBufferGetDataBuffer() returns nil value - Cocoa Swift

家住魔仙堡 提交于 2020-04-30 08:23:06
问题 I am trying to capture my system's screen and process the data. But I get nil value for CMSampleBufferGetDataBuffer for the sample buffer I get in captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) delegate method. Any idea? below is my code: import Cocoa import AVFoundation class ViewController: NSViewController, AVCaptureVideoDataOutputSampleBufferDelegate { private lazy var sampleBufferDelegateQueue = DispatchQueue(label:

Mac视频编辑器(从初级到高级,从付费到免费)

爱⌒轻易说出口 提交于 2020-04-24 15:41:12
mac一直以创意专业人士为目标,特别是在照片和视频编辑方面。Mac有许多功能强大的视频编辑应用可供选择。有些是为初学者制作的,而另一些则满足经验丰富的视频编辑者。 那么Mac上最佳视频编辑器有哪些?今天macdown小编为大家分享mac上好用的视频编辑软件,从专业到初级,从付费到免费,一起来看看吧! 最佳 Adobe Premiere Pro Adobe公司旗下的一款功能强大的视频编辑软件,具有智能化视频剪辑工具,可以为您提供采集、剪辑、调色、美化音频、字幕添加、输出、DVD刻录的一整套流程,并和其他Adobe软件高效集成,使您足以完成在编辑、制作、工作流上遇到的所有挑战,满足您创建高质量作品的要求。通过这款软件,用户可以发挥自己的创意以及天马行空的想法,制作各种有创意、新意的优秀视频作品。 最适合Mac用户的 Final Cut Pro X 一款由苹果公司开发专业视频非线性编辑器,经过彻底的重新设计后,Final Cut Pro 将革命性的视频编辑与强大的媒体整理和难以置信的性能相结合,可让您极速创作。 Final Cut Pro X为原生64位软件,基于Cocoa编写,支持多路多核心处理器,支持GPU加速,支持后台渲染,可编辑从标清到4K的各种分辨率视频,ColorSync管理的色彩流水线则可保证全片色彩的一致性。 Final Cut Pro

机器学习及flinkML算法学习

走远了吗. 提交于 2020-04-18 17:48:24
参考文章: 机器学习及flinkML算法学习 基于Flink流处理的动态实时亿级全端用户画像系统 机器学习概念 机器学习算法根据训练数据(training data)使得表示算法行为的数学目标最大化,并以此来进行预测或者做出决定。机器学习分为分类、回归、聚类等,每种都有不一样的目标。 应用场景和处理流程 所有的算法都需要定义每个数据点的特征(feature)集->输入; 正确的定义特征才是机器学习中最有挑战的部分。 大多数算法都是专为数据特征(就是一个代表各个特征值的数字向量)定义的,因此提取特征并转化为特征向量是机器学习过程中重要的一步。 输入数据分为“训练集”和“测试集”,并且只使用前者进行训练,这样就可以用后者来检验模型是否过度拟合了训练数据。 机器学习流水线会训练出多个不同版本的模型,然后分别对其进行评估。Ml提供几个算法进行模型评估。 常见的算法 分类算法 基于已经被标注的其他数据点作为例子来识别一个数据点属于几个类别中的哪一种;比如判断一封邮件是否为垃圾邮件。 垃圾邮件分类做法: HashingTF 文本数据构建词频特征向量 LogisticRegressionWithSGD 使用随机梯度下降法实现逻辑回归。 监督学习 SVM使用通信高效的分布式双坐标上升(CoCoA) 多元线性回归 优化框架 L-BFGS Generalized Linear Models

How to use hardcoded file path names with sandbox

微笑、不失礼 提交于 2020-04-17 22:51:26
问题 Ok, yes I know now that you can not use hardcoded paths with sandbox. Up to this point I have not delt with sandbox, so I never encountered it. I have a Coredata App (Mac OSx) and I used the default save code and the default path location (user/...../applicationsupport/... This, of coarse, is not acceptable in the sandbox. Without requiring the user to manually open the data file each time the program is launched, is there another way to deal with this? I would appreciate any input

NSOutlineView crash on Mac OS versions below 10.12 as 'stronglyReferencesItems' set to 'false' by default

两盒软妹~` 提交于 2020-04-17 22:49:05
问题 My app has an outline view which get frequent updates from server. Whenever I get an update I reload outline view. I do multiple operation with outline at the same time like showing some buttons on mouse over, expand/collapse items. For these operations I get item from outline view with NSOutlineView.item(atRow:) The issue is, at random scenarios my app is getting crashed with EXC_BAD_ACCESS (SIGSEGV) in areas where NSOutlineView internally calls NSTableView delegate methods on OS versions

Unable to set Image of NSImageView using file path

浪子不回头ぞ 提交于 2020-04-17 17:55:26
问题 I have hooked to Selection changed event of NSTableView.I need to display the selected image in the imageview func tableViewSelectionDidChange(_ notification: Notification) { let table = notification.object as! NSTableView print(fileArray[table.selectedRow].path); img_view.image=NSImage(named: NSImage.Name(rawValue: fileArray[table.selectedRow].path)) } The console prints /Users/myname/Downloads/435_v9_bc.jpg But the imageview does not display the image. Update 1: print(fileArray[table