How to maintain state of button

7 views
Skip to first unread message

pradip parkhe

unread,
Dec 23, 2011, 5:01:30 AM12/23/11
to iPhone-BitCode
hi, i want maintain state of a button .i.e. when i click the button
then it should maintain changed image of button when i login in
application next time.

Bharat Jagtap

unread,
Dec 25, 2011, 12:20:51 AM12/25/11
to iphone-...@googlegroups.com
You may store it in UserDefaults , like this

-(void)btnClicked
{
    [[NSUserDefaults standardUserDefaults]setBool:YES forKey:@"BUTTON_CHANGED"];
   
     
}

Then in AppDidFinishLaunching method write

    if ( [[NSUserDefaults standardUserDefaults]boolForKey:@"BUTTON_CHANGED"] )
    {
        [btn setSelected:YES];
       
    }

 


--
BitCode Technologies Pvt. Ltd.
Find more about us at:  http://www.bitcode.in
Check out the iPhone Tutorials : http://www.iphone-bitcode.blogspot.com

For more options, visit this group at
http://groups.google.com/group/iphone-bitcode?hl=en

Reply all
Reply to author
Forward
0 new messages