UIView+PublicInit.m 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // UIView+PublicInit.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/4/24.
  6. //
  7. #import "UIView+PublicInit.h"
  8. @implementation UIView (PublicInit)
  9. // MARK: - base create
  10. + (UIView *)baseV {
  11. UIView *v = [[UIView alloc] init];
  12. v.backgroundColor = UIColor.whiteColor;
  13. return v;
  14. }
  15. + (UILabel *)baseLb {
  16. UILabel *lb = [[UILabel alloc] init];
  17. // lb.font = [UIFont fontWithName:Rob_Regular size:14];
  18. lb.textColor = [UIColor blackColor];
  19. lb.backgroundColor = [UIColor clearColor];
  20. return lb;
  21. }
  22. + (UIImageView *)baseImgV {
  23. UIImageView *imgV = [[UIImageView alloc] init];
  24. imgV.contentMode = UIViewContentModeScaleAspectFit;
  25. return imgV;
  26. }
  27. + (UIStackView *)baseStackV:(BOOL)isVertical {
  28. UIStackView *stackV = [[UIStackView alloc] init];
  29. stackV.axis = isVertical ? UILayoutConstraintAxisVertical : UILayoutConstraintAxisHorizontal;
  30. stackV.spacing = 8;
  31. stackV.alignment = UIStackViewAlignmentFill;
  32. stackV.distribution = UIStackViewDistributionFill;
  33. return stackV;
  34. }
  35. @end