《iOS 7 日课》:开发者视角探索新系统

需积分: 9 0 下载量 62 浏览量 更新于2024-07-20 收藏 16.61MB PDF 举报
"iOS 7 day by day 是一本针对开发者详细解析iOS 7的电子书,由Sam Davies撰写,采用PDF格式。此书于2013年11月5日更新,通过Leanpub平台发布,旨在通过轻量级工具和多次迭代来获取读者反馈,以确保内容的质量和适应性。 Leanpub是一个支持作者和出版者的平台,鼓励采用精益出版流程,即在作品未完成时就开始发布并根据读者反馈进行调整。 这本书的目标读者是iOS开发者,内容结构清晰,附有源代码供读者参考。书中涵盖了从基础到进阶的各种主题,旨在帮助读者全面了解iOS 7的新特性和最佳实践。 书中第一天的内容专注于UIKit Dynamics,介绍了物理世界中的动态行为。作者通过构建一个摆动的钟摆示例,帮助读者理解如何在iOS应用中模拟真实世界的物理运动。这部分内容不仅讲解了基本概念,还展示了如何实现这些效果。 第二天的内容围绕NSURLSession展开,这是iOS中用于网络数据传输的框架。作者首先展示了简单的下载操作,然后逐步深入,讲解如何追踪下载进度、取消下载、恢复中断的下载以及如何在后台执行下载任务。这部分内容对于需要处理网络数据的iOS开发者尤其重要,因为NSURLSession提供了高效且灵活的网络管理方式。 第三天的内容介绍了Asset Catalog,这是iOS 7引入的一种新特性,用于管理应用的图像资源。Asset Catalog允许开发者更方便地组织和优化不同尺寸、状态和方向的图片,从而适应不同设备和屏幕分辨率。通过Asset Catalog,开发者可以更高效地管理资源,减少代码复杂性,提高应用性能。 这本书的每一部分都包含了详细的步骤和总结,帮助读者快速掌握每个主题的核心概念。通过这种方式,开发者可以在短短24天内,每天学习一个小节,逐步深入地理解iOS 7的关键技术。同时,作者鼓励读者在Twitter上分享书籍信息,并提供了特定的标签#iOS7DayByDay以便跟踪讨论和反馈。 "iOS 7 day by day"是一本实用且全面的iOS 7开发指南,适合有一定经验的iOS开发者,旨在帮助他们更好地利用新系统特性,提升开发效率和应用质量。"
2014-03-09 上传
iOS7 is probably the most significant change to Apple's mobile operating system since the launch of the iPhone3G. Not only does it completely revamp the UI, but it also introduces loads of really exciting new APIs that developers can use to make awesome apps. There are so many different areas of improvement / addition that I've decided to do a review for developers - in bite-size pieces. Today marks the launch of my daily blog series - iOS7 Day-by-Day. You can subscribe to the blog with the RSS feed option above - or follow me on twitter to be notified of when updates are posted. The following table of contents will be updated daily, so you should bookmark this page to get easy links to the entire series. Day 0 :: UIKit Dynamics Day 1 :: NSURLSession Day 2 :: Asset Catalog Day 3 :: Background Fetch Day 4 :: AVSpeechSynthesizer Day 5 :: UIDynamics with Collection Views Day 6 :: Tint Color Day 7 :: Taking Snapshots of UIViews Day 8 :: Reading list with SafariServices Day 9 :: Device Identification Day 10 :: Custom UIViewController Transitions Day 11 :: UIView Key-frame Animations Day 12 :: Dynamic Type and Font Descriptors Day 13 :: Route Directions with MapKit Day 14 :: Interactive View Controller Transitions Day 15 :: CoreImage Filters Day 16 :: Decoding QR Codes with AVFoundation Day 17 :: iBeacons Day 18 :: Detecting Facial Features with CoreImage Day 19 :: UITableView Row Height Estimation Day 20 :: View controller content and navigation bars Day 21 :: Multi-column TextKit text rendering Day 22 :: Downloadable Fonts Day 23 :: Multipeer Connectivity Day 24 :: The End Each day's post will have an associated sample project so that you can see the concepts in action. These will all be available in the github repo at github.com/ShinobiControls/iOS7-day-by-day. Let me know of any feedback or suggestions you might have.
2014-01-03 上传
The next step is to select a physical location on the hard disk and a logical location within your project for your new class; that is, the file folder and the group folder. In this step (see Figure 1-26), you can also decide whether your class should be included in the target (the executable file). This is usually what you want, but there might be situations when you want to exclude files, such as when you have more than one target, like a unit-test target. Most of the time you can just accept the default values for the locations, so go ahead and click “Create.” Xcode then generates two new files for your project: MyClass.h and MyClass.m. They contain the code of an empty class, as in the header and implementation files shown in Listing 1-5 and Listing 1-6. Listing 1-5. A new class header file // // MyClass.h // My App // #import <Foundation/Foundation.h> @interface MyClass : NSObject @end Listing 1-6. A new class implementation file // // MyClass.m // My App // #import "MyClass.h" @implementation MyClass @end Listing 1-8. A better way of handling potentially recoverable errors with a framework NSError *error = nil; if ([managedObjectContext save:&error] == NO) { [ErrorHandler handleError:error fatal:NO]; } Let’s set up the scaffolding for the internal error-handling framework. Start by creating a new single view application project. In this new project, create a new class file that subclasses NSObject. Give the new class the name “ErrorHandler.” Open ErrorHandler.h and add the declaration shown in Listing 1-9. Listing 1-9. Adding a declaration for the handleErrors: fatal: class method // // ErrorHandler.h // Default Error Handling // #import <Foundation/Foundation.h> @interface ErrorHandler : NSObject +(void)handleError:(NSError *)error fatal:(BOOL)fatalError; @end