Skip to main content

Posts

Showing posts from April, 2012

Use NSUserDefault

If you have an application that should save any values or objects or preferences (like : how to access preference from your iOS Applications )  for example state of a switch, state of background and you don’t want use database for that small request you can simply add instance of NSUserDefaults class in your implementation. Information About NSUserDefaults: With the NSUserDefaults class, you can save settings and properties related to application or user data. For example, you could save a profile image set by the user or a default color scheme for the application. The objects will be saved in what is known as the iOS “defaults system”. The iOS defaults system is available throughout all of the code in your app, and any data saved to the defaults system will persist through application sessions . This means that even if the user closes your application or reboots their phone, the saved data will still be available the next time they open the app! Main Points: ...

Creating Timestamp

In Objective C and iOS , Some times you need to create a time stamp(Unix Time Stamp Style) you use like this : NSString * timeStampValue = [NSString stringWithFormat:@"%d", (long)[[NSDate date] timeIntervalSince1970]]; NSLog(@"Time Stamp Value == %@", timeStampValue); /* Explain: This translates to current server time of 04/13/2012 @ 8:41am in EST. TIME STAMP: 1334320615 DATE (M/D/Y @ h:m:s): 04 / 13 / 12 @ 7:36:55am EST */ ======================== Output : 1334320615 ========================