Browse Source

bugfix: #239 set the default `textAlignment` to `NSTextAlignmentNatural`.

ibireme 9 years ago
parent
commit
3d885234cb
4 changed files with 4 additions and 2 deletions
  1. 1 1
      YYText/YYLabel.h
  2. 1 0
      YYText/YYLabel.m
  3. 1 1
      YYText/YYTextView.h
  4. 1 0
      YYText/YYTextView.m

+ 1 - 1
YYText/YYLabel.h

@@ -90,7 +90,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic) CGFloat shadowBlurRadius;
 @property (nonatomic) CGFloat shadowBlurRadius;
 
 
 /**
 /**
- The technique to use for aligning the text. Default is NSLeftTextAlignment.
+ The technique to use for aligning the text. Default is NSTextAlignmentNatural.
  Set a new value to this property also causes the new alignment to be applied to the entire `attributedText`.
  Set a new value to this property also causes the new alignment to be applied to the entire `attributedText`.
  Get the value returns the alignment at the head of `attributedText`.
  Get the value returns the alignment at the head of `attributedText`.
  */
  */

+ 1 - 0
YYText/YYLabel.m

@@ -390,6 +390,7 @@ static dispatch_queue_t YYLabelGetReleaseQueue() {
     _textColor = [UIColor blackColor];
     _textColor = [UIColor blackColor];
     _textVerticalAlignment = YYTextVerticalAlignmentCenter;
     _textVerticalAlignment = YYTextVerticalAlignmentCenter;
     _numberOfLines = 1;
     _numberOfLines = 1;
+    _textAlignment = NSTextAlignmentNatural;
     _lineBreakMode = NSLineBreakByTruncatingTail;
     _lineBreakMode = NSLineBreakByTruncatingTail;
     _innerText = [NSMutableAttributedString new];
     _innerText = [NSMutableAttributedString new];
     _innerContainer = [YYTextContainer new];
     _innerContainer = [YYTextContainer new];

+ 1 - 1
YYText/YYTextView.h

@@ -105,7 +105,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nullable, nonatomic, strong) UIColor *textColor;
 @property (nullable, nonatomic, strong) UIColor *textColor;
 
 
 /**
 /**
- The technique to use for aligning the text. Default is NSLeftTextAlignment.
+ The technique to use for aligning the text. Default is NSTextAlignmentNatural.
  Set a new value to this property also causes the new alignment to be applied to the entire `attributedText`.
  Set a new value to this property also causes the new alignment to be applied to the entire `attributedText`.
  Get the value returns the alignment at the head of `attributedText`.
  Get the value returns the alignment at the head of `attributedText`.
  */
  */

+ 1 - 0
YYText/YYTextView.m

@@ -1970,6 +1970,7 @@ typedef NS_ENUM(NSUInteger, YYTextMoveDirection) {
     _selectable = YES;
     _selectable = YES;
     _highlightable = YES;
     _highlightable = YES;
     _allowsCopyAttributedString = YES;
     _allowsCopyAttributedString = YES;
+    _textAlignment = NSTextAlignmentNatural;
     
     
     _innerText = [NSMutableAttributedString new];
     _innerText = [NSMutableAttributedString new];
     _innerContainer = [YYTextContainer new];
     _innerContainer = [YYTextContainer new];