ZSWTappableLabelTappableRegionInfoImpl.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // ZSWTappableLabelTappableRegionInfoImpl.m
  3. // ZSWTappableLabel
  4. //
  5. // Copyright (c) 2019 Zachary West. All rights reserved.
  6. //
  7. // MIT License
  8. // https://github.com/zacwest/ZSWTappableLabel
  9. //
  10. #import "ZSWTappableLabelTappableRegionInfoImpl.h"
  11. @interface ZSWTappableLabelTappableRegionInfoImpl()
  12. @property (nonatomic, readwrite) CGRect frame;
  13. @property (nonatomic, readwrite) NSDictionary<NSAttributedStringKey, id> *attributes;
  14. @property (nonatomic) UIView *containerView;
  15. @end
  16. @implementation ZSWTappableLabelTappableRegionInfoImpl
  17. - (instancetype)initWithFrame:(CGRect)frame
  18. attributes:(NSDictionary<NSAttributedStringKey, id> *)attributes
  19. containerView:(UIView *)containerView {
  20. if ((self = [super init])) {
  21. _frame = frame;
  22. _attributes = attributes;
  23. _containerView = containerView;
  24. }
  25. return self;
  26. }
  27. - (void)configurePreviewingContext:(id<UIViewControllerPreviewing>)previewingContext {
  28. previewingContext.sourceRect = [previewingContext.sourceView convertRect:self.frame
  29. fromView:self.containerView];
  30. }
  31. @end