12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- //
- // GoodWritUpImgV.m
- // westkissMob
- //
- // Created by 王猛 on 2022/10/6.
- //
- #import "GoodWritUpImgV.h"
- @implementation GoodWritUpImgV
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
- - (instancetype)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
- if(self){
- self.layer.cornerRadius = 4;
- self.userInteractionEnabled = YES;
- [self addSubview:self.closeBtn];
- self.closeBtn.frame = CGRectMake(frame.size.width-22,0 , 22, 22);
- }
- return self;
- }
- -(UIButton *)closeBtn{
- if(!_closeBtn){
- _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- _closeBtn.backgroundColor = [UIColor colorWithHexString:@"#0B0B0B" Alpha:0.6];
- [_closeBtn setTitle:@"X" forState:UIControlStateNormal];
- _closeBtn.titleLabel.font = [UIFont systemFontOfSize:16];
- [_closeBtn setTitleColor:[UIColor colorWithHexString:@"#FFFFFF"] forState:UIControlStateNormal];
- }
- return _closeBtn;
- }
- - (void)setIsCanTap:(BOOL)isCanTap{
- _isCanTap = isCanTap;
- if(isCanTap){
- self.closeBtn.hidden = YES;
- }else{
- self.closeBtn.hidden = NO;
- }
- }
- @end
|