ZSWTappableLabelTouchHandling.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // ZSWTappableLabelTouchHandling.h
  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 <Foundation/Foundation.h>
  11. #import <UIKit/UIKit.h>
  12. NS_ASSUME_NONNULL_BEGIN
  13. @interface ZSWTappableLabelTouchHandling : NSObject
  14. - (instancetype)initWithTextStorage:(NSTextStorage *)textStorage
  15. pointOffset:(CGPoint)pointOffset
  16. bounds:(CGRect)bounds;
  17. @property (nonatomic, readonly) NSTextStorage *textStorage;
  18. @property (nonatomic, readonly) NSLayoutManager *layoutManager;
  19. @property (nonatomic, readonly) NSTextContainer *textContainer;
  20. @property (nonatomic, readonly) CGPoint pointOffset;
  21. @property (nonatomic, readonly) CGRect bounds;
  22. @property (nonatomic, readonly) NSAttributedString *unmodifiedAttributedString;
  23. - (NSUInteger)characterIndexAtPoint:(CGPoint)point;
  24. - (BOOL)isTappableRegionAtPoint:(CGPoint)point;
  25. - (BOOL)isTappableRegionAtCharacterIndex:(NSUInteger)characterIndex;
  26. - (CGRect)frameForCharacterRange:(NSRange)characterRange;
  27. @end
  28. NS_ASSUME_NONNULL_END