1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- //
- // ShowBtn.m
- // smartRhino
- //
- // Created by niuzhen on 2020/2/26.
- // Copyright © 2020 tederen. All rights reserved.
- //
- #import "ShowBtn.h"
- @implementation ShowBtn
- - (instancetype)init
- {
- self = [super init];
- if (self) {
- }
- return self;
- }
- //- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
- // CGRect bounds = self.bounds;
- // CGFloat widthDelta = self.bounds.size.width * 1.5;
- // bounds = CGRectInset(bounds, - 0.5 * widthDelta, 0);
- // return CGRectContainsPoint(bounds, point);
- //}
- - (void)setLabelTitle:(NSString *)title
- {
- self.title = [NSString stringWithFormat:@"%@ ",title];
- NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17],NSForegroundColorAttributeName:UIColorHex(0x000000)}];
- NSTextAttachment *attach = [[NSTextAttachment alloc] init];
- attach.image = [UIImage imageNamed:@"chatmsg_notice_showAll_icon"];
- NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
- [attStr appendAttributedString:collegeStr];
- [attStr appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
- [self setAttributedTitle:attStr forState:UIControlStateNormal];
- }
- - (void)show
- {
- NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17],NSForegroundColorAttributeName:UIColorHex(0x000000)}];
- NSTextAttachment *attach = [[NSTextAttachment alloc] init];
- attach.image = [UIImage imageNamed:@"chatmsg_notice_hideAll_icon"];
- NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
- [attStr appendAttributedString:collegeStr];
- [self setAttributedTitle:attStr forState:UIControlStateNormal];
- }
- - (void)dismiss
- {
- NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title.length == 0 ? @" " : self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17],NSForegroundColorAttributeName:UIColorHex(0x000000)}];
- NSTextAttachment *attach = [[NSTextAttachment alloc] init];
- attach.image = [UIImage imageNamed:@"chatmsg_notice_showAll_icon"];
- NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
- [attStr appendAttributedString:collegeStr];
- [self setAttributedTitle:attStr forState:UIControlStateNormal];
- }
- - (void)setcomTitle:(NSString *)title
- {
- self.title = [NSString stringWithFormat:@"%@ ",title];
- NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title.length == 0 ? @" " : self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:UIColorHex(0x666666)}];
- NSTextAttachment *attach = [[NSTextAttachment alloc] init];
- attach.image = [UIImage imageNamed:@"chatmsg_notice_showAll_icon"];
- NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
- [attStr appendAttributedString:collegeStr];
- [attStr appendAttributedString:[[NSAttributedString alloc] initWithString:@" "]];
- [self setAttributedTitle:attStr forState:UIControlStateNormal];
- }
- - (void)showCom
- {
- NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:UIColorHex(0x666666)}];
- NSTextAttachment *attach = [[NSTextAttachment alloc] init];
- attach.image = [UIImage imageNamed:@"chatmsg_notice_hideAll_icon"];
- NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
- [attStr appendAttributedString:collegeStr];
- [self setAttributedTitle:attStr forState:UIControlStateNormal];
- }
- - (void)dismissCom
- {
- if (self.title.length == 0) {
- return;
- }
- NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] initWithString:self.title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:UIColorHex(0x666666)}];
- NSTextAttachment *attach = [[NSTextAttachment alloc] init];
- attach.image = [UIImage imageNamed:@"chatmsg_notice_showAll_icon"];
- NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
- [attStr appendAttributedString:collegeStr];
- [self setAttributedTitle:attStr forState:UIControlStateNormal];
- }
- @end
|