// // UIView+PublicInit.m // Asteria // // Created by iOS on 2023/4/24. // #import "UIView+PublicInit.h" @implementation UIView (PublicInit) // 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; } @end