iOS-进阶整理15- 定位和地图
2016-05-25 本文已影响326人
简单也好
计算时间差
NSCalendar *cal = [NSCalendar currentCalendar];
unsigned int unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
NSDateComponents *d = [cal components:unitFlags fromDate:date1 toDate:date2 options:0];
int sec = [d hour]*3600+[d minute]*60+[d second];
NSLog(@"second = %d",[d hour]*3600+[d minute]*60+[d second]);
加载UIView的XIB
_replyView = [[[NSBundle mainBundle]loadNibNamed:@"NewRushListView" owner:self options:nil]lastObject];
UIColor转换为string再转换回来
CGColorRef textDefaultColorRef = blockself.colorChooseView.colorPickerView.color.CGColor;
NSString *textDefaultColorStr = [CIColor colorWithCGColor:textDefaultColorRef].stringRepresentation;
CIColor *color =[CIColor colorWithString:textDefaultColorStr];
UIColor *c = [UIColor colorWithCIColor:color];