ITeye博客

Objective-C

共 2 篇文章

Objective-C NSDateFormater

NSDateFormatter *dateFormat = [[nsdateformatter alloc] init]; [dateformat setdateformat:@"yyyy-mm-dd hh:mm z"]; NSDate *selected = [datepicker date]; NSString *message = [[nsstring alloc] initWithFormat: @"The date and time you selected is: %@", [dateformat stringfromdate:selected]]; // output: 201…

2011-08-26 10:50 · L · Objective-C

Thu Rules of Cocoa Memory Management

When you create an object using [b]new, alloc, or copy[/b], the object has a retain count of 1. You are responsible for sending the object a release or autorelease message when you're done with it. That way, it gets cleaned up when its useful life is over. When you get hold of an object [b]via any …

2011-08-11 09:05 · L · Objective-C · objective-c memory management rule