Lieber Besucher, herzlich willkommen bei: OS X Entwicklerforum. Falls dies dein erster Besuch auf dieser Seite ist, lies bitte die Hilfe durch. Dort wird dir die Bedienung dieser Seite näher erläutert. Darüber hinaus solltest du dich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutze das Registrierungsformular, um dich zu registrieren oder informiere dich ausführlich über den Registrierungsvorgang. Falls du dich bereits zu einem früheren Zeitpunkt registriert hast, kannst du dich hier anmelden.
Benutzerinformationen überspringen
Wohnort: Düsseldorf
Beruf: Student
Hobbys: Programmieren, Computerspiele von Tetris über WoW bis Battlefield oder auch die Sims wenn die Langeweile zu groß ist.
|
|
PHP-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
- (void) awakeFromNib {
NSBundle* bundle = [NSBundle mainBundle];
filePath = [[bundle pathForResource:@"Contacts" ofType:@"plist"] retain];
contacts = [[[NSMutableArray alloc] init] autorelease];
NSFileManager* fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath]) {
NSMutableArray* contactsFile = [[NSMutableArray alloc] initWithContentsOfFile:filePath];
for (id contact in contactsFile) {
[arrayContacts addObject:contact];
}
}
[fileManager release];
}
|
|
|
PHP-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
- (IBAction)pushSave:(id)sender {
NSMutableDictionary* dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[txtName stringValue], @"name",
[txtFirstName stringValue], @"firstName",
[txtNumber stringValue], @"number",
[txtBirthDay stringValue], @"birthday",
nil];
[arrayContacts addObject:dict];
NSFileManager* fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath] || [fileManager isWritableFileAtPath:filePath]) {
[[arrayContacts arrangedObjects] writeToFile:filePath atomically:YES];
}
[fileManager release];
}
|
|
|
PHP-Quelltext |
1 2 3 |
- (IBAction)pushRemove:(id)sender {
[arrayContacts remove:self];
}
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Michael« (9. Oktober 2010, 22:50)
Benutzerinformationen überspringen
Wohnort: Düsseldorf
Beruf: Student
Hobbys: Programmieren, Computerspiele von Tetris über WoW bis Battlefield oder auch die Sims wenn die Langeweile zu groß ist.
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »asyx« (9. Oktober 2010, 23:12)
Benutzerinformationen überspringen
Wohnort: Düsseldorf
Beruf: Student
Hobbys: Programmieren, Computerspiele von Tetris über WoW bis Battlefield oder auch die Sims wenn die Langeweile zu groß ist.
|
|
PHP-Quelltext |
1 2 3 4 5 6 7 8 |
- (IBAction)pushRemove:(id)sender {
[arrayContacts remove:self];
NSFileManager* fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath] || [fileManager isWritableFileAtPath:filePath]) {
[[arrayContacts arrangedObjects] writeToFile:filePath atomically:YES];
}
[fileManager release];
}
|
|
|
PHP-Quelltext |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
- (void)handleChangeSelection:(NSNotification*)note {
NSMutableArray* arr = [arrayContacts arrangedObjects];
NSInteger index = [arrayContacts selectionIndex];
NSDictionary* dict = [arr objectAtIndex:index];
NSString* bday = [dict valueForKey:@"birthday"];
NSDate* today = [NSDate date];
NSDateFormatter* dfDay = [[[NSDateFormatter alloc] init] autorelease];
NSDateFormatter* dfMonth = [[[NSDateFormatter alloc] init] autorelease];
NSDateFormatter* dfYear = [[[NSDateFormatter alloc] init] autorelease];
[dfDay setDateFormat:@"dd"];
[dfMonth setDateFormat:@"MM"];
[dfYear setDateFormat:@"yyyy"];
NSString* dToday = [dfDay stringFromDate:today];
NSString* mToday = [dfMonth stringFromDate:today];
NSString* yToday = [dfYear stringFromDate:today];
NSArray* bdaySplitted = [bday componentsSeparatedByString:@"."];
NSInteger* dBday = [bdaySplitted objectAtIndex:0];
NSInteger* mBday = [bdaySplitted objectAtIndex:1];
NSInteger* yBday = [bdaySplitted objectAtIndex:2];
NSInteger* intDtoday = [dToday intValue];
NSInteger* intMtoday = [mToday intValue];
NSInteger* intYtoday = [yToday intValue];
NSInteger* intDBday = [dBday intValue];
NSInteger* intMBday = [mBday intValue];
NSInteger* intYBday = [yBday intValue];
NSInteger* maxDayMonth;
if(intDBday <= 7 && ((intMBday - intMtoday) == 1 || (intMBday - intMtoday) == 0)) {
if (intMtoday == 1 || intMtoday == 3 || intMtoday == 5 || intMtoday == 7 || intMtoday == 8 || intMtoday == 10 || intMtoday == 12) {
maxDayMonth = 31;
} else {
if (intMtoday == 4 || intMtoday == 6 || intMtoday == 9 || intMtoday == 11) {
maxDayMonth = 30;
} else {
if (intMtoday == 2) {
if ((intYtoday % 100) == 0) {
if ((intYtoday % 400) == 0) {
maxDayMonth = 29;
} else {
maxDayMonth = 28;
}
} else {
if ((intYtoday % 4) == 0) {
maxDayMonth = 29;
} else {
maxDayMonth = 28;
}
}
}
}
}
NSInteger* toEndOfMonth = maxDayMonth - intDtoday;
NSInteger* indicatorValue = toEndOfMonth + intDBday;
if (indicatorValue <= 7) {
[getLevelIndicator setIntValue:indicatorValue];
} else {
[getLevelIndicator setIntValue:7];
}
} else {
if (intDtoday > intDBday) {
[getLevelIndicator setIntValue:7];
} else {
NSInteger* indicatorValue = intDBday - intDtoday;
[getLevelIndicator setIntValue: indicatorValue];
}
}
}
|

Benutzerinformationen überspringen
Wohnort: Düsseldorf
Beruf: Student
Hobbys: Programmieren, Computerspiele von Tetris über WoW bis Battlefield oder auch die Sims wenn die Langeweile zu groß ist.
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »asyx« (10. Oktober 2010, 21:35)