CStampButton.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // CStampButton.m
  3. // ComPDFKit_Tools
  4. //
  5. // Copyright © 2014-2024 PDF Technologies, Inc. All Rights Reserved.
  6. //
  7. // THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
  8. // AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
  9. // UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
  10. // This notice may not be removed from this file.
  11. //
  12. #import "CStampButton.h"
  13. @implementation CStampButton
  14. - (instancetype)initWithFrame:(CGRect)frame {
  15. if (self = [super initWithFrame:frame]) {
  16. self.stampBtn = [[UIButton alloc] init];
  17. self.stampBtn.layer.cornerRadius = 20;
  18. self.stampBtn.layer.masksToBounds = YES;
  19. [self addSubview:self.stampBtn];
  20. self.titleLabel = [[UILabel alloc] init];
  21. self.titleLabel.textColor = [UIColor whiteColor];
  22. self.titleLabel.backgroundColor = [UIColor clearColor];
  23. [self addSubview:self.titleLabel];
  24. self.backgroundColor = [UIColor clearColor];
  25. }
  26. return self;
  27. }
  28. - (void)layoutSubviews {
  29. [super layoutSubviews];
  30. self.stampBtn.frame = CGRectMake(self.bounds.size.width - 40, 0, 40, self.bounds.size.height);
  31. self.titleLabel.frame = CGRectMake(0, 0, 120, self.bounds.size.height);
  32. }
  33. @end