I want to show the time difference between last login time & current login time. That means, the message should be in the form like "Logged 5 mins ago". This message will be showed in a toolbar which placed in a tableview. How can i do it?
Another question is, even开发者_JS百科 though i show the message, for each a minute, can i refresh the toolbar to get the updated time?
Store the last login time in userDefaults,
Calculate the time difference by,
NSTimeInterval timeDiff = [loginTime timeIntervalSinceNow];
int diff=trunc(timeDiff/(60*60));
Display the value in toolbar
精彩评论