// // KWTextField.m // westkissMob // // Created by iOS on 2022/9/19. // #import "KWTextField.h" @implementation KWTextField - (instancetype)init { self = [super init]; if (self) { [self setStyle]; } return self; } - (void)setStyle { self.borderStyle = UITextBorderStyleNone; self.layer.borderColor = [[UIColor colorWithHexString:@"#000000"] CGColor]; self.layer.borderWidth = 1; self.layer.cornerRadius = 4; self.layer.masksToBounds = true; self.backgroundColor = UIColor.whiteColor; self.font = [UIFont fontWithName:Rob_Regular size:14]; self.textColor = [UIColor colorWithHexString:@"#0b0b0b"]; self.textAlignment = NSTextAlignmentCenter; } @end @implementation UIView(baseInit) // MARK: - base create + (UIView *)baseV { UIView *v = [[UIView alloc] init]; v.backgroundColor = UIColor.whiteColor; return v; } + (UILabel *)baseLb { UILabel *lb = [[UILabel alloc] init]; lb.font = [UIFont fontWithName:Rob_Regular size:14]; lb.textColor = [UIColor blackColor]; lb.backgroundColor = [UIColor clearColor]; return lb; } + (UIImageView *)baseImgV { UIImageView *imgV = [[UIImageView alloc] init]; imgV.contentMode = UIViewContentModeScaleAspectFit; return imgV; } + (UIStackView *)baseStackV:(BOOL)isVertical { UIStackView *stackV = [[UIStackView alloc] init]; stackV.axis = isVertical ? UILayoutConstraintAxisVertical : UILayoutConstraintAxisHorizontal; stackV.spacing = 8; stackV.alignment = UIStackViewAlignmentFill; stackV.distribution = UIStackViewDistributionFill; return stackV; } + (UIImage *)snapshotWithView:(UIView *)view { UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, [UIScreen mainScreen].scale); [view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } @end