自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

jichw的专栏

不忘初心,方得始终。

  • 博客(157)
  • 资源 (17)
  • 收藏
  • 关注

原创 程序员能力矩阵 Programmer Competency Matrix

注意:每个层次的知识都是渐增的,位于层次n,也蕴涵了你需了解所有低于层次n的知识。 计算机科学 Computer Science - 2n(Level 0) n2(Level 1) n(Level 2) log(n)(Level 3) 数据结构 不知道数组和链表的差异 能够解释和使用数组,链表,字典等,并且能够用于实际的编程任务。 了解基本数据结构时间和空间的折中,

2016-03-14 18:15:44 702

原创 开发资料

开源ReactNative项目列表学习资料-书籍iOS文章列表iOS开源列表Awesome iOSA curated list of awesome iOS ecosystem, including Objective-C and Swift ProjectsOpen-Source iOS AppsSwiftFileKitFileKit is a Swift f...

2018-05-14 16:04:13 821

原创 Xcode插件和配色

xcode8+如何安装插件Xcode插件安装方式:Github下载插件然后用xcode打开运行一遍,然后重启xcode。安装插件管理Alcatraz,通过其来安装插件不需要到github一个个下载插件来运行,统一管理插件,省时高效直观一些常用的高效插件FuzzyAutocompletePluginKSImageNamedXcodeBoostVVDocument...

2018-05-14 15:39:35 953

原创 webView内容高度,自适应高度

实现思路: webView加载H5链接,设置它为tableView的headerView,下方评论信息用Cell加载展示。 在webView的回调方法webViewDidFinishLoad中获取网页内容高度,设置为webView的高度,重新将webView赋给tableView的headerView。 Tip:将一个View赋值给UITableView的tabl...

2018-05-14 15:38:50 3128

原创 UIViewAnimation动画与Core Animation的CATransition类动画

使用UIView类函数实现// UIViewAnimationTransitionFlipFromLeft, 向左转动// UIViewAnimationTransitionFlipFromRight, 向右转动// UIViewAnimationTransitionCurlUp, 向上翻动// UIViewAnimationTransitionCurlDown, 向下翻动[U...

2018-05-14 15:37:45 516

原创 UITableViewCell嵌套UIWebView

获取UIWebView高度- (void)webViewDidFinishLoad:(UIWebView *)webView { // 如果要获取webView高度必须在网页加载完成之后获取 // 方法一 CGFloat height = [self.webView sizeThatFits:CGSizeZero].height; // 方法二 C...

2018-05-11 17:36:21 485

原创 UIlabel的行间距和字间距

比如一个Label的默认间距效果是这样 然后用一个封装起来的Category来调整这部分文字的行间[UILabel changeLineSpaceForLabel:cell.describeLabel WithSpace:5.0];调整后的效果是这样的其中5.0就是我自定义的文字间距。这是一个UILabel的Category,他的内部实现是这样的 UILabe...

2018-05-11 17:35:18 4028

原创 UIButton的title和image

UIButton的默认布局是:title在右,image在左; 一种是设置UIButton的以下两个属性:// default is UIEdgeInsetsZero@property(nonatomic) UIEdgeInsets titleEdgeInsets;// default is UIEdgeInsetsZero@property(nonatomic) UIEd...

2018-05-11 17:34:37 726

原创 UIApplication(2)

每个app有且只有一个UIApplication对象,当程序启动的时候通过调用UIApplicationMain方法得到的。可以通过sharedApplication方法得到。UIApplication对象的主要任务是处理用户事件的处理路径,例如分发一个UIEvent到另外一个对象去处理。UIApplication对象持有众多的UIWindow对象,因此可以组织app的展示。UIApplica...

2018-05-11 17:33:32 296

原创 UIApplication

UIApplication 类在整个App运行过程中,扮演一个中央处理和协调的工作,任何程序应该只有一个 UIApplication 实例。当一个app 被推出时,系统会调用 UIApplicationMain 函数,在它的其它任务中,这个函数创建了一个单利 UIApplication 对象,此后,你可以调用 shareApplication 方法来获取此对象。此外,UIApplicat...

2018-05-11 17:31:49 341

原创 Scheme & Rewrite

原文地址 苹果核 - 解耦神器 —— 统跳协议和Rewrite引擎题记:天猫App长大了,已经长成了流量以千万计规模的App,当下至少有10个团队在直接维护天猫App。在App长大,团队扩充的过程中解耦是一个永恒的话题,而界面解耦又是App架构的重中之重。统跳协议是天猫App统一跳转协议,主要负责天猫App界面之间的串联,也就是界面跳转服务。Rewrite引擎是与之配合的一套UR...

2018-05-11 17:31:19 408

原创 python中查看变量内存地址的方法

id(object) -> integerReturn the identity of an object. This is guaranteed to be unique amongsimultaneously existing objects. (Hint: it's the object's memory address.) 使用:id(obj) id(o...

2018-05-11 17:30:43 19833

原创 Pod公共库

GitHub新建自己的git repository将项目clone到本地git clone [email protected]:xxx/xxx.git初始化好项目,将Pod库文件建立好目录给仓库创建个podspec文件pod spec create xxx [email protected]:xxx/xxx.git编写xxx.podspec文件项目中不...

2018-05-11 17:29:49 621

原创 pip常见的使用方法

pip升级自己:$ pip install --upgrade pip查找与安装:使用search、install这两个参数。安装到用户目录:$ pip install pkg_name --user查看某个库的信息:$ pip show Jinja2---Name: Jinja2Version: 2.7.3Location: /path/t...

2018-05-11 17:29:04 4117

原创 Objective-C Runtime类的加载与初始化( load; initialize)

我们知道,iOS App的 main() 函数位于 main.m 中,这是我们熟知的程序入口,但是在这之前, 还要先进行加载 framework 、初始化 runtime 等操作, framework 的加载是由 dylb 调用的,关于 dylb ,这里不作探讨,感兴趣的同学可以看看这篇文章(dyld: Dynamic Linking On OS X )。本文结合 runtime 源码,对类的加载...

2018-05-11 17:28:16 830

原创 NSPredicate

Cocoa用NSPredicate描述查询的方式 原理类似于在数据库中进行查询 // 基本的查询 NSPredicate *predicate; predicate = [NSPredicate predicateWithFormat: @"name == 'Herbie'"]; BOOL match = [predicate evalua...

2018-05-07 10:35:30 494

原创 LLDB出现 message sent to deallocated instance

LLDB出现message sent to deallocated instance错误本文在源文的基础上做整理:http://www.devdiv.com/home.php?mod=space&uid=50901&do=blog&id=50856解决LLDB模式下出现message sent to deallocated instance错误Xcode版本...

2018-05-07 10:33:45 618

原创 Masonry(二)

安装直接进入github进行源码下载使用CocoaPod使用要创建一个试图,距离上下左右都是10的这样一个约束使用Masonry的效果UIEdgeInsets padding = UIEdgeInsetsMake(10, 10, 10, 10);[view1 mas_makeConstraints:^(MASConstraintMaker *make) { ...

2018-05-07 10:32:55 672

原创 Masonry(一)

简介 Masonry is still actively maintained, we are committed to fixing bugs and merging good quality PRs from the wider community. However if you’re using Swift in your project, we recommend using Sn...

2018-05-07 10:32:08 913

原创 iOS如何做优化

今天来讨论下整体项目优化本文只是提供了可以从哪些方面进行优化,没有对每个方向提供可参考的思路。有的时候还是需要结合业务逻辑进行 画了个图整理下参考以下数据(图片来自网络,侵删)应用首次工作出错以后,79%的用户只会再重试一两次;当应用载入时间超过3秒钟时,25%的用户会放弃使用该应用;31%的用户会将糟糕的体验转告他人; 数...

2018-05-07 10:30:48 623

原创 iOS开发规范(OC)

语言使用US英语代码组织在函数分组和protocol/delegate实现中使用#pragma mark -来分类方法,要遵循以下一般结构:#pragma mark - Lifecycle- (instancetype)init {...}- (void)dealloc {...}- ...

2018-05-07 10:29:54 697

原创 iOS国际化

程序国际化准备工作:首先我们要先创建一个工程,我们给他命名Internationalization-Demo,然后添加语言。从代码中分离文本:目前,应用展示的所有文本都是以硬编码字符串存在于Main.storyboard和 ViewController里。为了本地化这些字符串,你需要把它们放在一个单独的文件中。他将会在包中简单地引用这些字符串,而不是在你的方法中进行硬编...

2018-05-07 10:29:00 247

原创 iOS 网络优化

DNS查找时间可以使用的工具$ dig www.baidu.com$ traceroute www.baidu.com 最小化应用使用的专有域名的数量 如果子域名数量上升至两位数,我们需要仔细考虑这方面的优化了 冷启动时不必要链接的域名 对于后续的子域名,尝试更早的进行DNS解析,也被称为DNS预先下载 DNS预先下载...

2018-05-07 10:28:22 472

原创 GitHub资料

iOS 常用的知识点总结XAlign功能强大,使用方便,可高度自定义的TabBarController水波浪圆形进度控件,采用 CAShapeLayer,CADisplayLink 波浪动画,简单,流畅...

2018-05-07 10:27:20 362

原创 Git_Commit message & Change log

Git 每次提交代码,都要写 Commit message(提交说明),否则就不允许提交。$ git commit -m "hello world"上面代码的-m参数,就是用来指定 commit mesage 的。如果一行不够,可以只执行git commit,就会跳出文本编辑器,让你写多行。$ git commit可以这样Commit Logs From Last ...

2018-05-07 10:26:38 1204

原创 贝叶斯公式/贝叶斯法则/贝叶斯定理

介绍贝叶斯法则贝叶斯定理是用来做什么的?简单说,概率预测:某个条件下,一件事发生的概率是多大?wiki 把为什么要做这个定理谈的很清楚,是为了覆盖逆概的场景: 在贝叶斯写这篇文章之前,人们已经能够计算“正向概率”,如“假设袋子里面有N个白球,M个黑球,你伸手进去摸一把,摸出黑球的概率是多大”。 而一个自然而然的问题是反过来:“如果我们事先并不知道袋子里面黑白球的比例,...

2018-05-04 15:55:44 15585 5

原创 fastlane doc

文档 docs.fastlane.toolsApp Store DeploymentiOS App Store deployment using fastlane[Building your app](iOS App Store deployment using fastlane)fastlane takes care of building your app usi...

2018-05-04 15:49:52 281

原创 CocoaPods的spec

pod setup用于初始化本地第三方库的Spec描述文件,所有的spec文件存都存放在~/.cocoapods目录中。pod install用来安装或删除Podfile文件声明中的第三方依赖库。$ pod list# 列出所有可用的第三方库$ pod search query搜索名称包含query的类库,query可以替换为你想搜索的名字(如json),不区分大小写。也...

2018-04-27 10:09:38 1132

原创 Core Animation-壹

图层的内容动画Core Animation提供的基础设施让轻松创建复杂图层动画变得异常简单,Core Animation扩展了所有拥有图层的视图。例如改变图层框架矩形的尺寸,改变其在屏幕上的位置,应用旋转变换,改变它的透明度。使用Core Animation初始化一个动画和改变属性一样简单,但你也可以显式的创建一个动画并设置动画的参数。用简单的动画表现图层属性的变化 你可以以显式或隐式的...

2018-04-27 10:08:50 261

原创 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 304

转载 CocoaPod 私有库

私有库用途pods的出现极大的加速了iOS开发的速度,强大的包管理,以及强大的协作能力,让它极大的加快了我们的开发的效率。 除了开放的第三方库,我们需要自己的私有pod。比如开发项目时,我们可以结合git来形成新的开发模式。 通过这种形式,可以剥离出每一个模块,让模块之间的耦合率降到最低。每个人可以随时pull``commit,其他组员可以通过pod update来升级自己的接口,这样我...

2018-04-27 10:05:59 367

原创 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 524

原创 CGContextRef

CGContextRef An opaque type that represents a Quartz 2D drawing environment. Graphics Context是图形上下文,可以将其理解为一块画布,我们可以在上面进行绘画操作,绘制完成后,将画布放到我们的view中显示即可,view看作是一个画框.看一下demo效果图先:自定义CustomVie...

2018-04-27 10:02:42 325

原创 AOP/iOS中如何实现AOP

什么是AOP AOP:Aspect Oriented Programming,译为面向切面编程。在不修改源代码的情况下,通过运行时给程序添加统一功能的技术。我觉得其中有两层涵义:第一:不修改源代码,即尽可能的解耦。第二:添加统一的功能,即我们能实现的是添加统一的单一的功能,在某处使用AOP,我们只能实现一项单一的功能。如:日志记录。当然你可以添加多个AOP的模块到项目中,...

2018-04-27 10:01:58 2323

原创 自定义 Xcode ViewController 类模板

Xcode 类模板 例如创建一个 UIViewController,一个 Category 等等,这些其实都是 Xcode 帮我们集成好的模板。自定义 Xcode 类模板 当我们用 Xcode 自带的模板创建一个 UIViewController 的子类时,我们会发现 .m 文件会多出一些方法而我们平时的开发中,或多或少都有自己的一些规范,尤其是在多人合...

2018-04-27 09:59:06 1278

原创 在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 620

原创 镂空文字、类歌词进度显示文字

Demo详见GitHub:JXTMarkLabel镂空文字 - JXTHollowOutLabel镂空文字效果的实现基于drawRect重绘,具体参考了两篇帖子: Drawing a path with subtracted text using Core Graphics drawRect drawing ‘transparent’ text? ...

2018-04-27 09:56:08 605

原创 断言Assertion

什么是断言 在程序设计中,断言(assertion)是一种放在程序中的一阶逻辑(如一个结果为真或是假的逻辑判断式),目的是为了标示与验证程序开发者预期的结果 -当程序运行到断言的位置时,对应的断言应该为真。若断言不为真时,程序会中止运行,并给出错误消息。使用断言用错误处理代码来处理预期会发生的状况,用断言来处理绝不应该发生的状况。避免把需要执行的代码放到断言中...

2018-04-26 15:59:40 7474

原创 代码异味 (Code smells)

如果一段代码是不稳定或者有一些潜在问题的,那么代码往往会包含一些明显的痕迹。正如食物要腐坏之前,经常会发出一些异味一样。我们管这些痕迹叫做 代码异味 。No.1 重复代码 (Duplicated Code)解决方案:同一个class内的两个函数含有相同的表达式。——需要Extract Method,提炼出重复代码,然后让两个地点都调用被提炼出来的那一段代码。两个互为兄弟...

2018-04-26 15:57:20 2466

转载 常用的正则表达式

正则表达式 正则表达式,一个十分古老而又强大的文本处理工具,仅仅用一段非常简短的表达式语句,便能够快速实现一个非常复杂的业务逻辑。熟练地掌握正则表达式的话,能够使你的开发效率得到极大的提升。正则表达式经常被用于字段或任意字符串的校验,如下面这段校验基本日期格式的JavaScript代码:var reg = /^(\\d{1,4})(-|\\/)(\\d{1,2})\\2(\\...

2018-04-26 15:49:39 297

xz-5.2.2.tar.gz源码

xz-5.2.2.tar.gz 安装源码

2016-04-26

mysql-5.6.28源码

mysql5.6 源码

2016-04-25

iOS 私有API iphone-private-frameworks

iOS 私有API iphone-private-frameworks git上的貌似很久没维护了

2015-03-11

关东升iOS开发指南 随书源码下载(3)

关东升iOS开发指南 随书源码下载(3) 完整随书代码 文件太大分三次上传

2015-03-11

关东升iOS开发指南 随书源码下载(2)

关东升iOS开发指南 随书源码下载完整版 文件太大 分三次上传

2015-03-11

关东升iOS开发指南 随书源码下载(1)

关东升iOS开发指南 随书源码下载(1) 随书源码第二版下载

2015-03-11

iOS 酒店app 餐饮类app 源码

iOS 餐饮类app 源码 酒店app 简单实现源码

2015-03-11

UITableView

UITableView 的简单实例 便于理解

2015-03-11

twitter启动页动画

类似twitter启动页的动画源码 先将启动图片换成一张静态图片,之后再加载动画

2015-03-11

iOS 手势密码 源码

iOS 手势密码 源码 纯代码 页面切换 适配 仍有一些未完成的bug 基本功能实现了

2015-03-11

动画 删除view 页面切换

多个方式的页面切换实例,参考方便集成 删除view

2015-03-11

类似美团的下拉菜单

ios 纯代码 源码 美团 下拉菜单 只有下拉菜单。简单源码分享

2015-03-11

开源中国 完整客户端 源码

开源中国 iOS 客户端完整源码,Github 不断维护中的项目 欢迎下载参考

2015-03-11

2048源码分享

2048源码分享,看看这种算法吧 完整版

2015-03-11

纯代码控件 包含大部分控件

纯代码控件 包含1LWindow,2LUIView,3LUIViewController,4LUIViewUIImageViewUILabel,5LUIButtonUITextFieldUITextView,6LUIScrollView,7LUITableView,8LUITableViewCustomCell,9VCNavDemo,10LUITabBarViewController

2015-03-11

4s~6plus 代码适配 仅供参考

4s~6plus 代码适配(非xib) 仅供参考 详细说明 看一下代码内注释,用用就习惯了

2015-03-11

iOS-2048-master

2048游戏源码 # 2048 This is a derivative and the iOS version of the game 2048. In the very unlikely case that you don't know what it is, you can check it out [here](https://github.com/gabrielecirulli/2048). Made just for fun! You can find it on the [App Store](https://itunes.apple.com/us/app/2048-and-more!/id848859070?ls=1&mt=8). <p align="center"> <img src="http://a4.mzstatic.com/us/r30/Purple4/v4/a4/f8/af/a4f8af1d-3878-0817-859d-de76bae169c7/screen568x568.jpeg" alt="Screenshot"/> </p> ## AI An AI is added, thanks to [DJBen](https://github.com/DJBen)! Tap "Hint" to show hint (e.g. Move left/right/up/down); tap "Auto Run" to run AI automatically. Check it out in the `AI` branch. You can also check out [this demo video on YouTube](https://www.youtube.com/watch?v=GF0ANNPpF8E). Thanks to [ov3y](https://github.com/ov3y/2048-AI)'s Javascript version that gave me (DJBen, that is) inspiration. ### Issues and pending improvements Currently the searching depth is 2 and it fails sometimes. You can increase the number to 3 or more by changing the return value of `- (NSInteger)maximumSearchingDepth` in `M2GlobalState+AI.h`. Ideally, the AI should search from 0 depth to infinity and have a time out, it records the current best move when finish searching the current depth and stops immediately when timed out and return the best move so far. However, I have a little bit of trouble when dealing with `NSOperationQueue` so I didn't do it this way. Now the AI only searches at the specified `-maximumSearchingDepth`. ## The Game Since it is a *derivative* of the original 2048, it is not the *same*. More explicitly, it has the following additions: * **Three board sizes**: 3x3, 4x4 and 5x5. The smaller the board is, the fewer cells you have, and the harder the game is.* * **Three game modes**: The original Power of 2, i.e. combining two tiles of the same value to produce their sum. The Power of 3, i.e. combining *three* consecutive tiles of the same value to produce their sum. Not surprisingly, this is pretty hard with the 3x3 board, although I found it pretty easy to get 81. 243 is a different story... And the Fibonacci sequence, i.e. combining two adjacent numbers in the sequence 2, 3, 5, 8, 13... (I omitted the two 1's in the beginning) to produce the one next to the larger value. This is pretty tricky. Try it out and you will know what I mean. * **Three themes**: I made a bright theme and a 'joyful' theme in addition to the original one. In case you wonder how to do themes in iOS. (There may be a better way, but themes are verbose in nature, because you *have to* specify all the colors, fonts, etc.) ## The Technology This version of 2048 is built using SpriteKit, the new 2-D game engine Apple introduced to iOS 7. As a result, it requires iOS 7 to run. On the other hand, this app has the following two great properties: * It does not rely on *any* third-party library. Not that Cocos-2D is not great, but the fact it's using SpriteKit means that it does not have any dependencies. * It does not have any images. That's right. The entire UI is done either via UIKit, or by Core Graphics. Check out the related files to see how that is done, if you are curious. You should be able to download the source, and build and run without problem. However, please note that you may not want to run it in the simulator unless you don't have an Apple Developer account. SpriteKit does use OpenGL, and simulating that using CPU will cause your computer to take off. ## The Code First off, the best thing about the code is that it's pretty well documented. Most methods have the Apple-style documentation, which means that you can triple-click on the method name to get its documentation. The code started to resemble the structure of the original 2048. So for example, it has a game manager, a board class, a tile class, etc. I at least *tried* to stick to MVC as much as possible. Here is a brief summary to get you started: * The `M2GameManager` class controls the game logic. There is only one action in the game: move. So the majority of that class is handling the move. The rest is checking whether you've won or died, etc. * The `M2Grid` class is the data structure for the board. The original 2048 used a 1-D array, but heck, 2-D array doesn't seem to be too bad here! ...except looping it is a bit ugly, so I made a `forEach` helper function. * The `M2Cell` class is the "slot"s. They are not the tiles themselves. The benefit of having this class is that the cells never move, so they are good references and they don't mess stuff up. * The `M2Tile` class is the actual tile, and **this** is the actual SpriteKit class. If all you want is some sample code for SpriteKit, here it is. I believe my animations are smoother than the other 2048 on the App Store, and are closer to the original animation. * The `M2GlobalState` class is a global class accessible from anywhere in the universe. Well, global stuff is evil, right? At least so we are told. But, it is at least better to encapsulate the global stuff into one single object (namespace), and that's a singleton right there. * The `M2Theme` class and its subclasses control the theme. * There are also some controller classes and view classes. It's probably a better idea to do the Game Over scene in SpriteKit, but I was lazy so I faked it using a view. The `M2GridView` class is the one that draws the board, btw. ### Contributing If you'd like to contribute, great! That's more than welcome. If you do make improvements to it, remember to put yourself in the "About 2048" page to get yourself credit. If you'd like to fork and make your own version, that's also great! Feel free to tinker with it however you'd like. It may not be a terribly good idea to change the font, add some ads, and submit to Apple, though. #### Contributors * Danqing Liu (me) * [Scott Matthewman](https://github.com/scottmatthewman) * [Sihao Lu](https://github.com/DJBen) ## Licence and Other 2048 for iOS is licenced under the MIT license. If you find the source code somewhat useful, all I ask is to download it from the [App Store](https://itunes.apple.com/us/app/2048-and-more!/id848859070?ls=1&mt=8), so I know that *someone* has seen it. Relax: It is free; it does not have any ads or weird stuff; it does not send you push notifications to ask you to go back and play it. You may also consider to [donate](https://github.com/gabrielecirulli/2048) to the maker of the original 2048 if you'd like, of course. (:

2015-03-11

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除