- 博客(20)
- 资源 (17)
- 收藏
- 关注
原创 CocoaPods的spec
pod setup用于初始化本地第三方库的Spec描述文件,所有的spec文件存都存放在~/.cocoapods目录中。pod install用来安装或删除Podfile文件声明中的第三方依赖库。$ pod list# 列出所有可用的第三方库$ pod search query搜索名称包含query的类库,query可以替换为你想搜索的名字(如json),不区分大小写。也...
2018-04-27 10:09:38 1229
原创 Core Animation-壹
图层的内容动画Core Animation提供的基础设施让轻松创建复杂图层动画变得异常简单,Core Animation扩展了所有拥有图层的视图。例如改变图层框架矩形的尺寸,改变其在屏幕上的位置,应用旋转变换,改变它的透明度。使用Core Animation初始化一个动画和改变属性一样简单,但你也可以显式的创建一个动画并设置动画的参数。用简单的动画表现图层属性的变化 你可以以显式或隐式的...
2018-04-27 10:08:50 274
原创 CocoaPods 的安装
移除现有Ruby默认源$ gem sources --remove https://rubygems.org/使用新的源$ gem sources -a https://ruby.taobao.org/验证新源是否替换成功$ gem sources -l安装CocoaPods$ sudo gem install cocoapods 备...
2018-04-27 10:07:37 325
转载 CocoaPod 私有库
私有库用途pods的出现极大的加速了iOS开发的速度,强大的包管理,以及强大的协作能力,让它极大的加快了我们的开发的效率。 除了开放的第三方库,我们需要自己的私有pod。比如开发项目时,我们可以结合git来形成新的开发模式。 通过这种形式,可以剥离出每一个模块,让模块之间的耦合率降到最低。每个人可以随时pull``commit,其他组员可以通过pod update来升级自己的接口,这样我...
2018-04-27 10:05:59 383
原创 Charles Mac
HTTP抓包打开Charles程序查看Mac电脑的IP地址,系统偏好设置->网络就可以查看到了,比如我的ip地址是:192.168.1.7打开iOS设置,进入当前wifi连接(Mac在一个局域网内),设置HTTP代理Group,将服务器填为上一步中获得的IP,即192.168.1.7,端口填8888:iOS设备打开你要抓包的app进行网络操作Charles弹出确认框,...
2018-04-27 10:04:50 577
原创 CGContextRef
CGContextRef An opaque type that represents a Quartz 2D drawing environment. Graphics Context是图形上下文,可以将其理解为一块画布,我们可以在上面进行绘画操作,绘制完成后,将画布放到我们的view中显示即可,view看作是一个画框.看一下demo效果图先:自定义CustomVie...
2018-04-27 10:02:42 338
原创 AOP/iOS中如何实现AOP
什么是AOP AOP:Aspect Oriented Programming,译为面向切面编程。在不修改源代码的情况下,通过运行时给程序添加统一功能的技术。我觉得其中有两层涵义:第一:不修改源代码,即尽可能的解耦。第二:添加统一的功能,即我们能实现的是添加统一的单一的功能,在某处使用AOP,我们只能实现一项单一的功能。如:日志记录。当然你可以添加多个AOP的模块到项目中,...
2018-04-27 10:01:58 2342
原创 自定义 Xcode ViewController 类模板
Xcode 类模板 例如创建一个 UIViewController,一个 Category 等等,这些其实都是 Xcode 帮我们集成好的模板。自定义 Xcode 类模板 当我们用 Xcode 自带的模板创建一个 UIViewController 的子类时,我们会发现 .m 文件会多出一些方法而我们平时的开发中,或多或少都有自己的一些规范,尤其是在多人合...
2018-04-27 09:59:06 1292
原创 在Mac OS X中配置Apache + PHP + MySQL
Mac OS X 内置Apache 和 PHP,使用起来非常方便。本文以Mac OS X 10.6.3和 10.8.1为例。主要内容包括:启动Apache运行PHP安装MySQL启动Apache有两种方法:打开系统设置偏好(System Preferences) -> 共享(Sharing) -> Web共享(Web Sharing)。注意,从...
2018-04-27 09:58:04 643
原创 镂空文字、类歌词进度显示文字
Demo详见GitHub:JXTMarkLabel镂空文字 - JXTHollowOutLabel镂空文字效果的实现基于drawRect重绘,具体参考了两篇帖子: Drawing a path with subtracted text using Core Graphics drawRect drawing ‘transparent’ text? ...
2018-04-27 09:56:08 623
原创 断言Assertion
什么是断言 在程序设计中,断言(assertion)是一种放在程序中的一阶逻辑(如一个结果为真或是假的逻辑判断式),目的是为了标示与验证程序开发者预期的结果 -当程序运行到断言的位置时,对应的断言应该为真。若断言不为真时,程序会中止运行,并给出错误消息。使用断言用错误处理代码来处理预期会发生的状况,用断言来处理绝不应该发生的状况。避免把需要执行的代码放到断言中...
2018-04-26 15:59:40 7566
原创 代码异味 (Code smells)
如果一段代码是不稳定或者有一些潜在问题的,那么代码往往会包含一些明显的痕迹。正如食物要腐坏之前,经常会发出一些异味一样。我们管这些痕迹叫做 代码异味 。No.1 重复代码 (Duplicated Code)解决方案:同一个class内的两个函数含有相同的表达式。——需要Extract Method,提炼出重复代码,然后让两个地点都调用被提炼出来的那一段代码。两个互为兄弟...
2018-04-26 15:57:20 2539
转载 常用的正则表达式
正则表达式 正则表达式,一个十分古老而又强大的文本处理工具,仅仅用一段非常简短的表达式语句,便能够快速实现一个非常复杂的业务逻辑。熟练地掌握正则表达式的话,能够使你的开发效率得到极大的提升。正则表达式经常被用于字段或任意字符串的校验,如下面这段校验基本日期格式的JavaScript代码:var reg = /^(\\d{1,4})(-|\\/)(\\d{1,2})\\2(\\...
2018-04-26 15:49:39 311
原创 使用Carthage 错误 xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH
xcrun: error: unable to find utility “xcodebuild”, not a developer tool or in PATHhttps://stackoverflow.com/questions/40743713/command-line-tool-error-xcrun-error-unable-to-find-utility-xcodebui...
2018-04-26 09:30:20 1848
原创 DZNEmptyDataSet 在Swift4.1 中使用
特点效果图使用方法DZNEmptyDataSet协议DZNEmptyDataSetSource设置默认空白界面处理视图的标题title.设置默认空白界面处理视图的描述description文本。设置默认空白界面布局的图片。设置默认空白界面布局图片的前景色,默认为nil.设置默认空白界面图片的动画效果。设置默认空白界面响应按钮的标题,通常我们可以设置为”重新加载”等文本。...
2018-04-26 09:27:00 2803 2
原创 CocoaPods 出现 Unable to find a pod with name, author, summary, or description matching
其他问题[!] Unable to find a pod with name, author, summary, or description matching `AF`执行 pod setup 其实在你安装 CocoaPods 执行 pod install 时,系统会默认操作 pod setup ,然而由于墙可能会 pod setup 不成功。这时就需要手动执行 po...
2018-04-26 09:24:42 12553
原创 oh-my-zsh终端用户名设置(PS1)
zsh安装,参考 oh-my-zsh默认的 PS1 为PS1='[\u@\h \w]\$' 网上对这个的处理大多是打开.bashrc然后修改PS1或者重新定义修改PS1 但 oh-my-zsh 的 shell 是 zsh,明显不能在 .bashrc 中改不信可以在终端输入echo $PS1或者echo $PROMPT可以看到其定义为...
2018-04-26 09:22:35 13063 2
原创 Swift条件判断中逗号的使用方法示例
在Swift语言中,Bool 值是用来进行条件判断的,可以进行 && 以及 || 的操作,从而实现多个表达式共同判断。但是由于Swift中存在可选项绑定,或者说是用 let 展开可选项的原因,有些地方条件判断中不能够使用 && 来进行处理。比如,我们要在变量 hasValue 确实有值,且参数个数 paramCount 大于 0 的时候,执行代码,一般我们可以这...
2018-04-26 09:19:44 698
原创 iOS获取设备型号和App版本号等信息(OC & Swift)
获取设备名称OC代码NSString *deviceName = [[UIDevice currentDevice] name];Swift代码let deviceName = UIDevice.currentDevice().name获取系统版本号OC代码NSString *sysVersion = [[UIDevice currentDevice...
2018-04-26 09:16:15 1572
原创 Swift - typealias
typealias用来为已存在的类型重新定义名称的。通过命名,可以使代码变得更加清晰。使用的语法也很简单,使用 typealias 关键字像普通的赋值语句一样,可以将某个在已经存在的类型赋值为新的名字。重新定义闭包类型或者说 block Swift的闭包书写虽然好看了不少,但是如果大批量的书写闭包还是很累的而且还影响可读性和美观,所以不妨试试 typealias。// 声...
2018-04-26 09:14:19 3453
纯代码控件 包含大部分控件
2015-03-11
iOS-2048-master
2015-03-11
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人