持久化雪花视图实例学习

【实例学习】
在实践Pdf版书中P52的例子中,继续学习:

NSMutableArray类
    The NSMutableArray class declares the programmatic interface to objects that manage a modifiable array of objects. This class adds insertion and deletion operations to the basic array-handling behavior inherited from NSArray.

    NSMutableArray类,声明可编程接口,用于管理对象的可变数组。这个类在继承NSArray类的基础数组操作方法上,新增添加和修改操做。

方法:
    insertObject:atIndex:
    removeObjectAtIndex:
    addObject:
    removeObject:
    removeLastObject
    replaceObjectAtIndex:withObject:

NSUserDefaults类
    The NSUserDefaults class provides a programmatic interface for interacting with the defaults system. The defaults system allows an application to customize its behavior to match a user’s preferences. For example, you can allow users to determine what units of measurement your application displays or how often documents are automatically saved. Applications record such preferences by assigning values to a set of parameters in a user’s defaults database. The parameters are referred to as defaults since they’re commonly used to determine an application’s default state at startup or the way it acts by default.

    此类为与默认系统交互提供可编程接口。默认系统允许程序定制符合用户呈现的的行为。

方法:
    Getting Default Values
    – arrayForKey:
    – boolForKey:
    – dataForKey:
    – dictionaryForKey:
    – floatForKey:
    – integerForKey:
    – objectForKey:
    – stringArrayForKey:
    – stringForKey:
    – doubleForKey:
    – URLForKey:
    Setting Default Values
    – setBool:forKey:
    – setFloat:forKey:
    – setInteger:forKey:
    – setObject:forKey:
    – setDouble:forKey:
    – setURL:forKey:
    Removing Defaults
    – removeObjectForKey:

    - synchronize:此函数是自动执行,用于保存此类的修改数据。手工调用此函数,一般情况都是在退出时候需要及时保存,不再等待自动保存。

类方法:
    standardUserDefaults:返回共享默认对象,类型是NSUserDefaults


UIApplicationDelegate Protocol(UIApplicationDelegate协议接口)

    The UIApplicationDelegate protocol declares methods that are implemented by the delegate of the singleton UIApplication object.
    UIApplicationDelegate协议接口声明单件UIApplication对象的委托函数方法。

    大部分都是采用默认执行,在实际开发中需要的毕竟是少数,此例子用了applicationWillTerminate,就是说程序中断时触发

罗列下:
    Monitoring Application State Changes
    – application:didFinishLaunchingWithOptions:
    – applicationDidBecomeActive:
    – applicationWillResignActive:
    – applicationDidEnterBackground:
    – applicationWillEnterForeground:
    – applicationWillTerminate:
    – applicationDidFinishLaunching:
    Opening a URL Resource
    – application:handleOpenURL:
    – application:openURL:sourceApplication:annotation:
    Managing Status Bar Changes
    – application:willChangeStatusBarOrientation:duration:
    – application:didChangeStatusBarOrientation:
    – application:willChangeStatusBarFrame:
    – application:didChangeStatusBarFrame:
    Responding to System Notifications
    – applicationDidReceiveMemoryWarning:
    – applicationSignificantTimeChange:
    Handling Remote Notifications
    – application:didReceiveRemoteNotification:
    – application:didRegisterForRemoteNotificationsWithDeviceToken:
    – application:didFailToRegisterForRemoteNotificationsWithError:
    Handling Local Notifications
    – application:didReceiveLocalNotification:
    Responding to Content Protection Changes
    – applicationProtectedDataWillBecomeUnavailable:
    – applicationProtectedDataDidBecomeAvailable:

最后说明下,在测试中没有测试出那段代码~~也就是说没有找到触发那个applicationWillTerminate的方法。

PS:再次说明下,+类方法,-成员方法;:意味此方法带有参数
posted @ 2011-05-19 14:53  西就东城  阅读(697)  评论(0编辑  收藏  举报