摘要:
最近写代码用到比较多的字符串操作的,所以找到一个objective-c中字符串操作的汇总,和大家分享!//创建字符串对象数组NSArray *array = [str componentsSeparatedByString:@"@"];//就是以@为标示 输出看看啦int count=[array count];int i;for(i=0;i<count;i=i+4){ printf("%i: %s\n",i,[[array objectAtIndex:i] UTF8String]);} 可变的字符串类NSMutableString *song=[ 阅读全文
摘要:
//定时提醒-(void)schedulNotificationWithYear:(int)y andMonth:(int)m andDay:(int)d andHour:(int)h andMintu:(int)mi andMsg:(NSString *)msg{ // Set up the fire time NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar]; NSDateComponents *dateComps = [[NSDateComponents alloc] init]; ... 阅读全文
摘要:
1、增加一个本地推送//设置20秒之后 NSDate *date = [NSDate dateWithTimeIntervalSinceNow:20]; //chuagjian一个本地推送 UILocalNotification *noti = [[[UILocalNotification alloc] init] autorelease]; if (noti) { //设置推送时间 noti.fireDate = date; //设置时区 noti.timeZone = [NSTimeZone defaultTimeZ... 阅读全文
摘要:
NSDate类用于保存时间值,同时提供了一些方法来处理一些基于秒级别时差(Time Interval)运算和日期之间的早晚比较等。1.创建或初始化可用以下方法用于创建NSDate实例的类方法有 + (id)date;返回当前时间 + (id)dateWithTimeIntervalSinceNow:(NSTimeInterval)secs;返回以当前时间为基准,然后过了secs秒的时间 + (id)dateWithTimeIntervalSinceReferenceDate:(NSTimeInterval)secs;返回以2001/01/01 GMT为基准,然后过了secs秒的时间 + (id 阅读全文