CCUserDefault与OC的NSUserDefaults

cocos2d-x 简单存储功能



 CCUserDefault::sharedUserDefault()->setStringForKey("pwd","123");



    CCUserDefault::sharedUserDefault()->flush();//存入xml

 



 str= CCUserDefault::sharedUserDefault()->getStringForKey("pwd");



    CCLog("打印我的密码=:%s",str.c_str());



Object C的用法



 



 



[[NSUserDefaults standardUserDefaults] setValue:textField.text forKey:@"selectbase"];



      NSString*pwdString=[[NSUserDefaults standardUserDefaults] objectForKey:@"pwd"];

 

你可能感兴趣的:(NSUserDefaults)