From 3e8437ae559487362fae3525beb79c534c213a51 Mon Sep 17 00:00:00 2001 From: 单军华 Date: Thu, 12 Jul 2018 13:44:34 +0800 Subject: [PATCH] bug修复和功能优化 --- screendisplay/screendisplay/Classes/ThirdClass/JHChart/JHShowInfoView.m | 80 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 80 insertions(+), 0 deletions(-) diff --git a/screendisplay/screendisplay/Classes/ThirdClass/JHChart/JHShowInfoView.m b/screendisplay/screendisplay/Classes/ThirdClass/JHChart/JHShowInfoView.m new file mode 100755 index 0000000..2461aa6 --- /dev/null +++ b/screendisplay/screendisplay/Classes/ThirdClass/JHChart/JHShowInfoView.m @@ -0,0 +1,80 @@ +// +// JHShowInfoView.m +// JHChartDemo +// +// Created by cjatech-������ on 16/5/4. +// Copyright �� 2016��� JH. All rights reserved. +// + +#import "JHShowInfoView.h" + + +@interface JHShowInfoView () + + +@property (nonatomic,strong) UILabel * bgLabel; + +@end + + +@implementation JHShowInfoView + + +-(instancetype)init{ + + if (self = [super init]) { + self.layer.borderWidth = 2; + self.layer.cornerRadius = 5; + self.clipsToBounds = YES; + self.layer.masksToBounds = YES; + self.backgroundColor = [UIColor colorWithWhite:1 alpha:0.9]; + } + + return self; + +} + + +-(void)setShowContentString:(NSString *)showContentString{ + + + _showContentString = showContentString; + CGSize size = [showContentString boundingRectWithSize:CGSizeMake(50, 100) options:NSStringDrawingUsesFontLeading|NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:8],NSForegroundColorAttributeName:[UIColor darkGrayColor]} context:nil].size; + + self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, size.width+10, 30); + + if (_bgLabel==nil) { + + _bgLabel = [[UILabel alloc] initWithFrame:self.bounds]; + _bgLabel.center = CGPointMake(self.frame.size.width/2, self.frame.size.height/2); + _bgLabel.backgroundColor = [UIColor clearColor]; + _bgLabel.font = [UIFont systemFontOfSize:8]; + _bgLabel.textColor = [UIColor blackColor]; + _bgLabel.numberOfLines = 2; + [self addSubview:_bgLabel]; + + } + _bgLabel.frame = CGRectMake(0, 0, size.width, size.height); + _bgLabel.text = _showContentString; + _bgLabel.center = CGPointMake(self.frame.size.width/2, self.frame.size.height/2); + +} + +-(void)updateFrameTo:(CGRect)frame andBGColor:(UIColor *)bgColor andShowContentString:(NSString *)contentString{ + self.showContentString = contentString; + + [UIView animateWithDuration:0.5 animations:^{ + + + + self.layer.borderColor = bgColor.CGColor; + + self.center = CGPointMake(frame.origin.x, frame.origin.y); + + } completion:^(BOOL finished) { + + }]; + +} + +@end -- Gitblit v1.8.0