YYTextContainerView.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // YYTextContainerView.h
  3. // YYKit <https://github.com/ibireme/YYKit>
  4. //
  5. // Created by ibireme on 15/4/21.
  6. // Copyright (c) 2015 ibireme.
  7. //
  8. // This source code is licensed under the MIT-style license found in the
  9. // LICENSE file in the root directory of this source tree.
  10. //
  11. #import <UIKit/UIKit.h>
  12. #if __has_include(<YYKit/YYKit.h>)
  13. #import <YYKit/YYTextLayout.h>
  14. #else
  15. #import "YYTextLayout.h"
  16. #endif
  17. NS_ASSUME_NONNULL_BEGIN
  18. /**
  19. A simple view to diaplay `YYTextLayout`.
  20. @discussion This view can become first responder. If this view is first responder,
  21. all the action (such as UIMenu's action) would forward to the `hostView` property.
  22. Typically, you should not use this class directly.
  23. @warning All the methods in this class should be called on main thread.
  24. */
  25. @interface YYTextContainerView : UIView
  26. /// First responder's aciton will forward to this view.
  27. @property (nullable, nonatomic, weak) UIView *hostView;
  28. /// Debug option for layout debug. Set this property will let the view redraw it's contents.
  29. @property (nullable, nonatomic, copy) YYTextDebugOption *debugOption;
  30. /// Text vertical alignment.
  31. @property (nonatomic) YYTextVerticalAlignment textVerticalAlignment;
  32. /// Text layout. Set this property will let the view redraw it's contents.
  33. @property (nullable, nonatomic, strong) YYTextLayout *layout;
  34. /// The contents fade animation duration when the layout's contents changed. Default is 0 (no animation).
  35. @property (nonatomic) NSTimeInterval contentsFadeDuration;
  36. /// Convenience method to set `layout` and `contentsFadeDuration`.
  37. /// @param layout Same as `layout` property.
  38. /// @param fadeDuration Same as `contentsFadeDuration` property.
  39. - (void)setLayout:(nullable YYTextLayout *)layout withFadeDuration:(NSTimeInterval)fadeDuration;
  40. @end
  41. NS_ASSUME_NONNULL_END