开发者

How to show last login time as "Logged <sometime> ago" in a toolbar?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜