其他方法...?
NSArray *tmpArray = [self.zhiBiaoArray filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:[NSString stringWithFormat:@"month == '%@'", month]]];
NSString *regex = @"^[0-9]*$";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self matches %@",regex];
return [predicate evaluateWithObject:text];
根据数据中的对象的属性排序
tmpArray = [tmpArray sortedArrayUsingComparator:^NSComparisonResult(SuiFangItem *obj1, SuiFangItem *obj2) {
return [obj1.SUBDATE compare:obj2.SUBDATE] == NSOrderedAscending;}];
经典代码,标签 for 循环排序设置标签的 xy
for (NSInteger i = 0; i < tagBtnArray.count; i ++) {
UIButton *tagBtn = tagBtnArray[i];
if (i == 0) {
tagBtn.fd_x = 0;
tagBtn.fd_y = 0;
} else {
UIButton *previousBtn = tagBtnArray[i -1];
tagBtn.fd_x = CGRectGetMaxX(previousBtn.frame) + 10;
tagBtn.fd_y = previousBtn.fd_y;
if ((tagViewW - tagBtn.fd_x) < tagBtn.fd_width) {tagBtn.fd_x = 0;
tagBtn.fd_y = CGRectGetMaxY(previousBtn.frame) + 10;
}
}
}
XMLDictionary
将 xml 转成字典,再解析服务器返回一堆带有月份的数据,服务器并未做按月分组,本地实现按月分组
// 获得数据中存在的月份,共有哪几个月份
NSMutableArray *monthArray = [NSMutableArray array];
ZhiBiaoItem *firstItem = self.zhiBiaoArray[0];
[monthArray addObject:firstItem.month];
for (NSInteger i = 1; i < self.zhiBiaoArray.count; i ++) {
ZhiBiaoItem *item = self.zhiBiaoArray[i];
if (![item.month isEqualToString:firstItem.month]) {
if ([monthArray containsObject:item.month]) {
continue;
}
[monthArray addObject:item.month];
}
}
self.monthArray = monthArray;
// 根据月份进行分组
NSMutableDictionary *resultDict = [NSMutableDictionary dictionary];
for (NSString *month in monthArray) {
NSArray *tmpArray = [self.zhiBiaoArray filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:[NSString stringWithFormat:@"month == '%@'", month]]];
[resultDict setObject:tmpArray forKey:month];
}
self.resultDict = resultDict;
使用 AFN 忽略所有 https 证书、不检测域名的策略
AFSecurityPolicy *secPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone];
secPolicy.allowInvalidCertificates = YES;
secPolicy.validatesDomainName = NO;
_mgr.securityPolicy = secPolicy;
配置 AFN 本地 https证书? 不清楚如何配置
PNChart 修改 节点label 的大小,在源码中修改
- (CATextLayer *)createPointLabelFor:(CGFloat)grade pointCenter:(CGPoint)pointCenter width:(CGFloat)width withChartData:(PNLineChartData *)chartData {
CATextLayer *textLayer = [[CATextLayer alloc] init];
[textLayer setAlignmentMode:kCAAlignmentCenter];
[textLayer setForegroundColor:[chartData.pointLabelColor CGColor]];
[textLayer setBackgroundColor:[[[UIColor whiteColor] colorWithAlphaComponent:0.8] CGColor]];
[textLayer setCornerRadius:textLayer.fontSize / 8.0];
if (chartData.pointLabelFont != nil) {
[textLayer setFont:(__bridge CFTypeRef) (chartData.pointLabelFont)];
textLayer.fontSize = [chartData.pointLabelFont pointSize];
}
CGFloat textHeight = textLayer.fontSize * 1.1;
CGFloat textWidth = width * 7;
CGFloat textStartPosY;
}
- (void)setXLabels:(NSArray *)xLabels withWidth:(CGFloat)width {
}
- (void)setYLabels {
PNChartLabel *minLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (NSInteger) _chartCavanHeight - 10, (NSInteger) _chartMarginBottom, (NSInteger) _yLabelHeight)];
CGRect labelFrame = CGRectMake(0.0,
(NSInteger) (_chartCavanHeight + _chartMarginTop - index * yStepHeight) -10,
}
- (void)calculateChartPath:(NSMutableArray *)chartPath andPointsPath:(NSMutableArray *)pointsPath andPathKeyPoints:(NSMutableArray *)pathPoints andPathStartEndPoints:(NSMutableArray *)pointsOfPath {
int x = i * _xLabelWidth + _chartMarginLeft + _xLabelWidth / 2.0 + 6;
}
下载说明
☉本站所有源码和资源均由站长亲自测试-绝对保证都可以架设,运营!
☉如源码和资源有损坏或所有链接均不能下载,请告知管理员,
☉本站软件和源码大部分为站长独资,资源购买和收集,放心下载!
☉唯一站长QQ:1004003180 [人格担保-本站注重诚信!]
☉购买建议E-mail:1004003180@qq.com 源码收购 E-mail:1004003180@qq.com
☉本站文件解压密码 【文章内都自带解压密码,每个密码不同!】