R
rainsn2
Neues Mitglied
Thread Starter
- Dabei seit
- 10.09.2013
- Beiträge
- 7
- Reaktionspunkte
- 0
Hallo Leute
ich versuche seit einiger zeit einen zweiten timer zu erstellen
aber irgendwie klappt es nicht
hier mal meine m.file
Danke
ich versuche seit einiger zeit einen zweiten timer zu erstellen
aber irgendwie klappt es nicht
hier mal meine m.file
Code:
[FONT=Menlo]-([/FONT][COLOR=#BB2CA2][FONT=Menlo]void[/FONT][/COLOR][FONT=Menlo])updateLabel {[/FONT][FONT=Menlo] [/FONT]
[COLOR=#703DAA][FONT=Menlo][COLOR=#000000] [/COLOR]NSDateFormatter[COLOR=#000000] *dateformatter = [[[/COLOR]NSDateFormatter[COLOR=#000000] [/COLOR][COLOR=#3d1d81]alloc[/COLOR][COLOR=#000000]] [/COLOR][COLOR=#3d1d81]init[/COLOR][COLOR=#000000]];[/COLOR][/FONT][/COLOR]
[FONT=Menlo] [dateformatter [COLOR=#3d1d81]setDateFormat[/COLOR]:[COLOR=#d12f1b]@"dd/MM/yyyy HH:mm:SS"[/COLOR]];[/FONT]
[FONT=Menlo] [/FONT]
[COLOR=#D12F1B][FONT=Menlo][COLOR=#000000] [/COLOR][COLOR=#703daa]NSString[/COLOR][COLOR=#000000] *fathersDay1 = [/COLOR]@"12/09/2013 18:03:13"[COLOR=#000000];
NSString *fathersDay2 = [/COLOR]@"30/12/2013 22:41:44"[COLOR=#000000];[/COLOR][/FONT][/COLOR]
[FONT=Menlo] [/FONT]
[FONT=Menlo] [COLOR=#703daa]NSDate[/COLOR] *currentDate = [dateformatter [COLOR=#3d1d81]dateFromString[/COLOR]:fathersDay1];[/FONT]
[FONT=Menlo] [/FONT]
[COLOR=#703DAA][FONT=Menlo][COLOR=#000000] [/COLOR]NSCalendar[COLOR=#000000] *gregorian = [[[/COLOR]NSCalendar[COLOR=#000000] [/COLOR][COLOR=#3d1d81]alloc[/COLOR][COLOR=#000000]] [/COLOR][COLOR=#3d1d81]initWithCalendarIdentifier[/COLOR][COLOR=#000000]:[/COLOR]NSGregorianCalendar[COLOR=#000000]];[/COLOR][/FONT][/COLOR]
[COLOR=#3D1D81][FONT=Menlo][COLOR=#000000] [/COLOR][COLOR=#bb2ca2]int[/COLOR][COLOR=#000000] unitFlags = [/COLOR]NSDayCalendarUnit[COLOR=#000000] | [/COLOR]NSHourCalendarUnit[COLOR=#000000] | [/COLOR]NSMinuteCalendarUnit[COLOR=#000000] | [/COLOR]NSSecondCalendarUnit[COLOR=#000000];[/COLOR][/FONT][/COLOR]
[FONT=Menlo] [COLOR=#703daa]NSDateComponents[/COLOR] *components = [gregorian [COLOR=#3d1d81]components[/COLOR]:unitFlags [COLOR=#3d1d81]fromDate[/COLOR]:[COLOR=#4f8187]today[/COLOR] [COLOR=#3d1d81]toDate[/COLOR]:currentDate [COLOR=#3d1d81]options[/COLOR]:[COLOR=#272ad8]0[/COLOR]];[/FONT]
[FONT=Menlo] [/FONT]
[FONT=Menlo] [/FONT]
[FONT=Menlo] [COLOR=#bb2ca2]if[/COLOR] ([[COLOR=#4f8187]today[/COLOR] [COLOR=#3d1d81]timeIntervalSinceDate[/COLOR]:currentDate] <= [COLOR=#272ad8]0[/COLOR] )[/FONT]
[FONT=Menlo] [/FONT]
[FONT=Menlo] [COLOR=#4f8187]countdownLabel[/COLOR].[COLOR=#703daa]text[/COLOR] = [[COLOR=#703daa]NSString[/COLOR] [COLOR=#3d1d81]stringWithFormat[/COLOR]:[COLOR=#d12f1b]@"%02dDays, %02dHour, %02dmin., %02dsec."[/COLOR], components.[COLOR=#3d1d81]day[/COLOR], components.[COLOR=#3d1d81]hour[/COLOR], components.[COLOR=#3d1d81]minute[/COLOR], components.[COLOR=#3d1d81]second[/COLOR] ];
}
- ([COLOR=#bb2ca2]void[/COLOR])viewDidLoad {
[COLOR=#bb2ca2]self[/COLOR]->[COLOR=#4f8187]today[/COLOR] = [[COLOR=#703daa]NSDate[/COLOR] [COLOR=#3d1d81]date[/COLOR]];
[COLOR=#3D1D81][COLOR=#000000] [/COLOR][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000]->[/COLOR][COLOR=#4f8187]timer[/COLOR][COLOR=#000000] = [[/COLOR][COLOR=#703daa]NSTimer[/COLOR][COLOR=#000000] [/COLOR]scheduledTimerWithTimeInterval[COLOR=#000000]:([/COLOR][COLOR=#272ad8]1.0[/COLOR][COLOR=#000000]) [/COLOR]target[COLOR=#000000]:[/COLOR][COLOR=#bb2ca2]self[/COLOR][COLOR=#000000] [/COLOR]selector[COLOR=#000000]:[/COLOR][COLOR=#bb2ca2]@selector[/COLOR][COLOR=#000000](updateLabel) [/COLOR]userInfo[COLOR=#000000]:[/COLOR][COLOR=#bb2ca2]nil[/COLOR][COLOR=#000000] [/COLOR]repeats[COLOR=#000000]:[/COLOR][COLOR=#bb2ca2]YES[/COLOR][COLOR=#000000]];[/COLOR][/COLOR]
[COLOR=#3D1D81][COLOR=#000000] [[/COLOR][COLOR=#bb2ca2]super[/COLOR][COLOR=#000000] [/COLOR]viewDidLoad[COLOR=#000000]];[/COLOR][/COLOR]
[/FONT]
Danke