Hey I have an initial screen that comes up when the app is launched the first time or when edit button is clicked, I will be taking a target date from the user using a date picker.
How can I then do a countdown on the home screen to this given date??
Please help!
Asked
Active
Viewed 251 times
0

Alison
- 13
- 1
- 5
3 Answers
0
Add NSTimer and use this two variables NSTimeInterval start = [[NSDate date] timeIntervalSince1970]; NSTimeInterval end = [selectedDate timeIntervalSince1970];

NeverBe
- 5,213
- 2
- 25
- 39
0
You could use timeIntervalSince
like this;
NSDate *chosenDate;
// Time interval between future date and todays date
NSTimeInterval *intervalInSeconds = [chosenDate timeIntervalSinceDate:[NSDate Date]];
Then you convert it to the units of your choice like this;

Community
- 1
- 1

Jonathan King
- 1,528
- 14
- 25
0
It sounds like are asking asking about how to share a property between screens. There are a couple approaches to this.
- Put the date property in your appDelegate
- Give your initial screen a reference to the home screen
- Give your home screen a reference to the initial screen
- Create a singleton that manages data for you.

Dancreek
- 9,524
- 1
- 31
- 34