react-native-navigation的迁移库

AnimatedTextView.m 997B

123456789101112131415161718192021222324252627282930313233
  1. #import "AnimatedTextView.h"
  2. @implementation AnimatedTextView {
  3. NSTextContainer* _fromTextContainer;
  4. CGSize _fromSize;
  5. }
  6. - (instancetype)initElement:(UIView *)element toElement:(UIView *)toElement transitionOptions:(SharedElementTransitionOptions *)transitionOptions {
  7. self = [super initElement:element toElement:toElement transitionOptions:transitionOptions];
  8. _fromTextStorage = [element valueForKey:@"textStorage"];
  9. _toTextStorage = [toElement valueForKey:@"textStorage"];
  10. _fromTextContainer = [self container:_fromTextStorage];
  11. _fromSize = _fromTextContainer.size;
  12. return self;
  13. }
  14. - (void)layoutSubviews {
  15. [super layoutSubviews];
  16. _fromTextContainer.size = self.bounds.size;
  17. self.reactView.frame = self.bounds;
  18. }
  19. - (void)reset {
  20. [super reset];
  21. _fromTextContainer.size = _fromSize;
  22. }
  23. - (NSTextContainer *)container:(NSTextStorage *)fromTextStorage {
  24. return fromTextStorage.layoutManagers.firstObject.textContainers.firstObject;
  25. }
  26. @end