iOS完整项目示例仓库
程序员要提高自己的编程能力,有两个捷径:一、多写代码不断做个人项目;二、多看多学习别人的代码,看代码要比写代码难很多倍。
程序员要提高自己的编程能力,有两个捷径:一、多写代码不断做个人项目;二、多看多学习别人的代码,看代码要比写代码难很多倍。
去App Store搜索并下载**『LightBlue』**这个App,对调试你的app和理解Core Bluetooth会很有帮助。
MFI —— 开发使用ExternalAccessory 框架
4.0 BLE —— 开发使用CoreBluetooth 框架
iOS Pre-Check-in Checklist | Yes/No |
---|---|
Have I regression tested everything in Instruments for leaks and abandoned memory? | |
Have I ran all automated UI tests and verified there are no crash bugs? | |
Have I ran all unit tests to insure I haven’t broken anything? | |
Did I do a compare of all the code to make sure all code is code review ready? | |
Have all new files been added into source control? | |
Have all work items been updated and ready to associate with the check-in? | |
Have I removed all code I commented out that no longer needs to be there? | |
Have I written clean code comments? | |
Is there anything I hacked together quickly to get it to work but needs to be cleaned up? | |
Is there duplicate code that I could simplify into 1 location? | |
Is there debug code that needs to be removed or commented out? | |
Is all text localized for all supported languages? | |
Are all images provided by the graphic designer checked in? | |
Are there any warnings in the checked-out files that can be addressed in this check-in? | |
Are there new dev target/environment settings that I forgot to also add to the production target/environment? |
是否在Instruments中对内存泄露进行了回归测试?
Have I regression tested everything in Instruments for leaks and abandoned memory?
是否运行了所有的UI测试同时确认没有crash bugs?
Have I ran all automated UI tests and verified there are no crash bugs?
是否运行了所有的单元测试确保没有造成破坏?
Have I ran all unit tests to insure I haven’t broken anything?
是否进行了所有代码比较确保所有代码审查准备好了?
Did I do a compare of all the code to make sure all code is code review ready?
是否所有新文件都添加到源代码管理中?
Have all new files been added into source control?
是否所有工作项已经被更新并准备签入?
Have all work items been updated and ready to associate with the check-in?
是否移除了已经注释过不再使用的代码?
Have I removed all code I commented out that no longer needs to be there?
是否写了清晰的代码注释?
Have I written clean code comments?
是否有某个功能是仅仅为了让程序能迅速运行但是需要清除的(比如某段没有设计过的功能代码)?
Is there anything I hacked together quickly to get it to work but needs to be cleaned up?
是否有可以简化的重复代码?
Is there duplicate code that I could simplify into 1 location?
是否有需要移除或者注释掉的调试代码?
Is there debug code that needs to be removed or commented out?
是否所有支持多语言的文本都已经本地化?
Is all text localized for all supported languages?
是否由图形设计师提供的图片都已经签入?
Are all images provided by the graphic designer checked in?
是否在本次签入代码之前能够解决检出代码的警告?
Are there any warnings in the checked-out files that can be addressed in this check-in?
是否有新的开发的target/environment设置忘了添加到生产的 target/environment?
Are there new dev target/environment settings that I forgot to also add to the production target/environment?
Final Sanity Checks | Appearance | Functionality |
---|---|---|
Localized? | YES | NO |
Portrait/Landscape? | ||
Empty Data Source? | ||
Large Data Source? | ||
CRUD? | ||
All modes/perspectives? | ||
Different Entry/Exit points? | ||
Different User Settings? | ||
Without internet connection? | ||
iPhone & iPad? (if Universal) | ||
New Install? | ||
Different version of iOS? |
iOS中实现二维码和条形码扫描,两大开源组件 ZBarSDK 与 ZXing以及AVFoundation。AVFoundation.framework(iOS 7 )之后才添加了二维码扫描的功能。
1 | - (UIImage *)qrCodeGenerator:(NSString *)msg size:(CGSize)size { |
Demo下载:QRCodeScanner
UIScrollView中子视图建立约束不能实现滚动,要实现子视图的AutoLayout布局需要借助UIView来实现。
Equal Height
约束的优先级为Low(250),若要实现UIScrollView水平滚动修改Equal Width
约束的优先级为Low(250)Bottom Space to SuperView
约束;若是水平滚动,需要设置最右方的子视图添加一个Trailing space to SuperView
约束https://github.com/xwal/Demo/tree/master/UIScrollViewAutoLayout
iOS网络编程层次结构分为三层,从上往下依次为:
Cocoa层:是最上层的基于 Objective-C 的 API,比如 URL访问,NSStream,Bonjour,GameKit等,这是大多数情况下我们常用的 API。Cocoa 层是基于 Core Foundation 实现的。
Core Foundation层:因为直接使用 socket 需要更多的编程工作,所以苹果对 OS 层的 socket 进行简单的封装以简化编程任务。该层提供了 CFNetwork 和 CFNetServices,其中 CFNetwork 又是基于 CFStream 和 CFSocket。
OS层:最底层的 BSD Socket 提供了对网络编程最大程度的控制,但是编程工作也是最多的。因此,苹果建议我们使用 Core Foundation 及以上层的 API 进行编程。
本文将介绍如何在 iOS 系统下使用最底层的 Socket 进行编程。
iOS支付分为两类,第三方支付和应用内支付(内购)。
第三方支付包括:支付宝支付、微信支付、银联支付、百度钱包、京东支付等等。
应用内支付(In-App Purchase):在应用程序内购买虚拟商品。如果你在App Store上销售的应用程序,将收到支付金额的70%。
一个合理的目录结构首先应该是清晰的,让人一眼看上去就能大概了解目录的职责,且容易应对新的变化。
主目录按照业务分类,内目录按照模块分类(主目录按照MVC架构分类,内部根据项目模块分类)
优点:相对比较快定位对应的业务。
缺点:模块相关类太过分散,需要来回切换寻找文件,不方便开发。
1 | ├── Application |
主目录按照模块分类,内目录按照业务分类
优点:对模块的类集中化,方便管理与开发。
缺点:当几个模块共用一些类时,不太好归类。
1 | ├── Application |