BTUIKExpiryInputCollectionViewCell.m 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #import "BTUIKExpiryInputCollectionViewCell.h"
  2. #import "BTUIKAppearance.h"
  3. @implementation BTUIKExpiryInputCollectionViewCell
  4. - (instancetype)initWithFrame:(CGRect)frame
  5. {
  6. self = [super initWithFrame:frame];
  7. if (self) {
  8. self.label = [[UILabel alloc] init];
  9. self.backgroundColor = [BTUIKAppearance sharedInstance].formFieldBackgroundColor;
  10. self.label.font = [[BTUIKAppearance sharedInstance].font fontWithSize:24];
  11. self.label.textColor = [BTUIKAppearance sharedInstance].primaryTextColor;
  12. self.label.translatesAutoresizingMaskIntoConstraints = NO;
  13. self.label.textAlignment = NSTextAlignmentCenter;
  14. [self.contentView addSubview:self.label];
  15. UIView *bgView = [[UIView alloc] initWithFrame:self.frame];
  16. bgView.layer.cornerRadius = 4;
  17. self.selectedBackgroundView = bgView;
  18. self.selectedBackgroundView.backgroundColor = [[BTUIKAppearance sharedInstance].primaryTextColor colorWithAlphaComponent:0.1];
  19. [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[label]|"
  20. options:0
  21. metrics:nil
  22. views:@{@"label":self.label}]];
  23. [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[label]|"
  24. options:0
  25. metrics:nil
  26. views:@{@"label":self.label}]];
  27. }
  28. return self;
  29. }
  30. - (NSInteger)getInteger {
  31. return [self.label.text integerValue];
  32. }
  33. @end