首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

保留和加载数据 Save and load data(实例)

2012-08-08 
保存和加载数据 Save and load data(实例)?In this tutorial i will be showing you how to save and load

保存和加载数据 Save and load data(实例)

?

In this tutorial i will be showing you how to save and load data in your?applications

Features:

    1 Label1 Textfield3 Buttons

    Saving and loading data in apps is a major component for games such as saving?high scores or loading progress or just generally enabling the user to save and load the data they created within you app?

    ?

    -(IBAction)save{ NSString *savedstring = label.text; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setObject:savedstring forKey:@"savedstring"]; [defaults synchronize];}-(IBAction)load{ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSString *loadstring = [defaults objectForKey:@"savedstring"]; [label setText:loadstring];}-(IBAction)settext{ label.text = textfield.text;}?

    视频:?http://www.youtube.com/watch?feature=player_embedded&v=I0dP-sNbv94

    ?

    ?

    ?

热点排行