<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to use NSUserDefaults to save state of switch?</title>
	<atom:link href="http://inchoo.net/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/feed/" rel="self" type="application/rss+xml" />
	<link>http://inchoo.net/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/</link>
	<description>Magento Design and Magento Development Professionals - Inchoo</description>
	<lastBuildDate>Fri, 10 Sep 2010 04:05:15 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Mashkov Binn</title>
		<link>http://inchoo.net/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/comment-page-1/#comment-7540</link>
		<dc:creator>Mashkov Binn</dc:creator>
		<pubDate>Tue, 06 Jul 2010 21:08:46 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=1156#comment-7540</guid>
		<description>Or this::

static const NSString *kSwitchStateKey = @&quot;stateOfSwitch&quot;;

- (IBAction) saveState {
  [NSUserDefaults standardUSerDefaults] setBool:switch.on forKey:kSwitchStateKey];
}

- (void)viewWillAppear:(BOOL)animated {
 switch.on =  [NSUserDefaults standardUSerDefaults] boolForKey:kSwitchStateKey];
}</description>
		<content:encoded><![CDATA[<p>Or this::</p>
<p>static const NSString *kSwitchStateKey = @&#8221;stateOfSwitch&#8221;;</p>
<p>- (IBAction) saveState {<br />
  [NSUserDefaults standardUSerDefaults] setBool:switch.on forKey:kSwitchStateKey];<br />
}</p>
<p>- (void)viewWillAppear:(BOOL)animated {<br />
 switch.on =  [NSUserDefaults standardUSerDefaults] boolForKey:kSwitchStateKey];<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://inchoo.net/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/comment-page-1/#comment-5937</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Fri, 22 Jan 2010 03:41:02 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=1156#comment-5937</guid>
		<description>thanks for the info.  I was curious, do you know how to save the state of a UIButton?  I have an app where a UIButton is disabled when a user taps it.  I just need to find a way to save the state of the button for the next time the user launches the application.  Any help would be great.
-Thank you</description>
		<content:encoded><![CDATA[<p>thanks for the info.  I was curious, do you know how to save the state of a UIButton?  I have an app where a UIButton is disabled when a user taps it.  I just need to find a way to save the state of the button for the next time the user launches the application.  Any help would be great.<br />
-Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohit</title>
		<link>http://inchoo.net/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/comment-page-1/#comment-5762</link>
		<dc:creator>Mohit</dc:creator>
		<pubDate>Mon, 04 Jan 2010 11:16:22 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=1156#comment-5762</guid>
		<description>Is there is advisable to use NSUserDefaults for an application to save UserName, Email instead of Sqlite</description>
		<content:encoded><![CDATA[<p>Is there is advisable to use NSUserDefaults for an application to save UserName, Email instead of Sqlite</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ivan Kalaica</title>
		<link>http://inchoo.net/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/comment-page-1/#comment-1471</link>
		<dc:creator>Ivan Kalaica</dc:creator>
		<pubDate>Mon, 30 Mar 2009 18:37:08 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=1156#comment-1471</guid>
		<description>Thanks for advice Sahil Desai! I have by mistake put &quot;YES&quot; and &quot;NO&quot; - I ment &quot;ON&quot; and &quot;OFF&quot;. That&#039;s why I have decided to use a string. Just to show how to save state.</description>
		<content:encoded><![CDATA[<p>Thanks for advice Sahil Desai! I have by mistake put &#8220;YES&#8221; and &#8220;NO&#8221; &#8211; I ment &#8220;ON&#8221; and &#8220;OFF&#8221;. That&#8217;s why I have decided to use a string. Just to show how to save state.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sahil Desai</title>
		<link>http://inchoo.net/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/comment-page-1/#comment-1469</link>
		<dc:creator>Sahil Desai</dc:creator>
		<pubDate>Mon, 30 Mar 2009 17:12:15 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=1156#comment-1469</guid>
		<description>I actually always just use setBool:forKey: to set the values of switches, since they are already BOOL&#039;s and it just seems unintuitive to have to slap NSStrings into the mix.

Also should be noted that there are other useful methods in NSUserDefaults:

– setBool:forKey:  
– setFloat:forKey:  
– setInteger:forKey:  
– setObject:forKey: 

All quite self explanatory (see more here: http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html)</description>
		<content:encoded><![CDATA[<p>I actually always just use setBool:forKey: to set the values of switches, since they are already BOOL&#8217;s and it just seems unintuitive to have to slap NSStrings into the mix.</p>
<p>Also should be noted that there are other useful methods in NSUserDefaults:</p>
<p>– setBool:forKey:<br />
– setFloat:forKey:<br />
– setInteger:forKey:<br />
– setObject:forKey: </p>
<p>All quite self explanatory (see more here: <a href="http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html)" rel="nofollow">http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html)</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
