Eric 2011/01/26 星期三 - 17:17 发布
[textfield setTextColor:[NSColor redColor]];
[textfield setFont:[NSFont labelFontOfSize:10]];
Eric 2011/01/05 星期三 - 10:30 发布
参考:
http://stackoverflow.com/questions/902950/iphone-convert-date-string-to-a-relative-time-stamp
-(NSString *)dateDiff:(NSString *)origDate {
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setFormatterBehavior:NSDateFormatterBehavior10_4];
[df setDateFormat:@"EEE, dd MMM yy HH:mm:ss VVVV"];
NSDate *convertedDate = [df dateFromString:origDate];
[df release];
NSDate *todayDate = [NSDate date];
double ti = [convertedDate timeIntervalSinceDate:todayDate];
ti = ti * -1;
if(ti < 1) {
return @"never";
Eric 2010/12/30 星期四 - 14:40 发布
无参数
NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc]
initWithTarget:self
selector:@selector(method)
object:nil];
[queue addOperation:operation];
[operation release];
有参数
NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc]
initWithTarget:self
selector:@selector(mehtod:)
object:argument];
[queue addOperation:operation];
[operation release];
Eric 2010/12/22 星期三 - 16:18 发布
@interface NSData (MBBase64)
- (NSString *)base64Encoding;
@end
static const char encodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@implementation NSData (MBBase64)
- (NSString *)base64Encoding;
{
if ([self length] == 0)
return @"";
char *characters = malloc((([self length] + 2) / 3) * 4);
if (characters == NULL)
return nil;
NSUInteger length = 0;
NSUInteger i = 0;
while (i < [self length])
{
char buffer[3] = {0,0,0};
short bufferLength = 0;
while (bufferLength < 3 && i < [self length])
最新评论