This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[UIImage imageNamed: [[[[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIcons"] objectForKey:@"CFBundlePrimaryIcon"] objectForKey:@"CFBundleIconFiles"] objectAtIndex:0]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(([[[UIDevice currentDevice] systemVersion] floatValue]>=7.0?20:0)){ | |
UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem: UIBarButtonSystemItemFixedSpace target:nil action:nil]; | |
negativeSpacer.width = -10;//这个数值可以根据情况自由变化 | |
self.navigationItem.rightBarButtonItems = @[negativeSpacer,itemAdd, itemSearch]; | |
} else { | |
self.navigationItem.rightBarButtonItems = @[itemAdd, itemSearch]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scrollView.automaticallyAdjustsScrollViewInsets = NO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//获取当前时间 | |
NSDate *now = [NSDate date]; | |
//设置日期格式 | |
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
[dateFormatter setDateFormat:@"yyyyMMddHHmmssSSS"]; | |
//获取日期字符串 | |
NSString *dateString = [dateFormatter stringFromDate:now]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSCalendar *calendar = [NSCalendar currentCalendar]; | |
NSDateComponents *dateComponents = [calendar components:NSYearCalendarUnit | NSMonthCalendarUnit fromDate:[[NSDate alloc] init]]; | |
[dateComponents setMonth:dateComponents.month - 1]; | |
NSDate *lastMonthDate = [calendar dateFromComponents:dateComponents]; | |
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
dateFormatter.dateFormat = @"yyyyMM"; | |
lastMonthDateString = [dateFormatter stringFromDate:lastMonthDate]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create Regular Expression | |
NSError *error = NULL; | |
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:<# 正则表达式 #> options:<# 选项 #> error:&error]; | |
// Counting the number of matches in a given range of a string | |
NSUInteger numberOfMatches = [regex numberOfMatchesInString:<# 需要检查的字符串 #> option:<# NSMatchingOptions #> range:<# 检查的范围 #>]; | |
// Get the first match range and the string, method 1 | |
NSRange rangeOfFirstMatch = [regex rangeOfFirstMatchInString:<# 需要检查的字符串 #> options:0 range:NSMakeRange(0, [<# 需要检查的字符串 #> length])]; | |
if (!NSEqualRanges(rangeOfFirstMatch, NSMakeRange(NSNotFound, 0))) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Wundeclared-selector" | |
<# ... your code here ... #> | |
#pragma clang diagnostic pop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSData *jsonData = [<# 需要转换的 JSON 字符串 #> dataUsingEncoding:NSUTF8StringEncoding]; | |
id json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil]; |
OlderNewer