<?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/mobile-development/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/</link>
	<description>Magento Design and Magento Development Professionals - Inchoo</description>
	<lastBuildDate>Tue, 22 May 2012 16:01:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Patty</title>
		<link>http://inchoo.net/mobile-development/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/comment-page-1/#comment-22727</link>
		<dc:creator>Patty</dc:creator>
		<pubDate>Sat, 17 Sep 2011 17:06:40 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=1156#comment-22727</guid>
		<description>Where in my ios code would I put these SAVE and LOAD methods... if I didn&#039;t want to make the user hit SAVE and LOAD buttons each time?

Just &#039;load on launch&#039; and &quot;save on exit&#039;.</description>
		<content:encoded><![CDATA[<p>Where in my ios code would I put these SAVE and LOAD methods&#8230; if I didn&#8217;t want to make the user hit SAVE and LOAD buttons each time?</p>
<p>Just &#8216;load on launch&#8217; and &#8220;save on exit&#8217;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomislav</title>
		<link>http://inchoo.net/mobile-development/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/comment-page-1/#comment-22418</link>
		<dc:creator>Tomislav</dc:creator>
		<pubDate>Mon, 22 Aug 2011 10:44:05 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=1156#comment-22418</guid>
		<description>Hvala :)</description>
		<content:encoded><![CDATA[<p>Hvala <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anupdas</title>
		<link>http://inchoo.net/mobile-development/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/comment-page-1/#comment-20148</link>
		<dc:creator>Anupdas</dc:creator>
		<pubDate>Tue, 29 Mar 2011 13:17:11 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=1156#comment-20148</guid>
		<description>Thanks for the tutorial, it saved a lot of time...Kudos</description>
		<content:encoded><![CDATA[<p>Thanks for the tutorial, it saved a lot of time&#8230;Kudos</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hardik</title>
		<link>http://inchoo.net/mobile-development/iphone-development/how-to-use-nsuserdefaults-to-save-state-of-switch/comment-page-1/#comment-20092</link>
		<dc:creator>hardik</dc:creator>
		<pubDate>Thu, 24 Mar 2011 11:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://inchoo.net/?p=1156#comment-20092</guid>
		<description>nice example,
gr8.

thanks.</description>
		<content:encoded><![CDATA[<p>nice example,<br />
gr8.</p>
<p>thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mashkov Binn</title>
		<link>http://inchoo.net/mobile-development/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/mobile-development/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/mobile-development/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/mobile-development/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/mobile-development/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>

