iOS 7开发(英文档)

时间:2017-01-23 12:16:42
【文件属性】:

文件名称:iOS 7开发(英文档)

文件大小:17.01MB

文件格式:RAR

更新时间:2017-01-23 12:16:42

iOS 7开发 英文档

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 @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 @interface ErrorHandler : NSObject +(void)handleError:(NSError *)error fatal:(BOOL)fatalError; @end


【文件预览】:
iOS 7开发(英文档)
----iOS 7开发(英文档).pdf(22.32MB)

网友评论

  • 还不错。英文的,凑合着看。关键时刻还是有用的。
  • 可惜了,是英文的