Permalink
Browse files

allow the attributed string's text to be updated

  • Loading branch information...
1 parent fe94918 commit a8670dcd203e45fa88ea277a1a92884589fa6dad @joshaber joshaber committed May 31, 2012
Showing with 16 additions and 0 deletions.
  1. +1 −0 lib/UIKit/TUIAttributedString.h
  2. +10 −0 lib/UIKit/TUIAttributedString.m
  3. +5 −0 lib/UIKit/TUITextRenderer.m
@@ -69,6 +69,7 @@ typedef enum {
@property (nonatomic, assign) TUITextAlignment alignment; // setting this will set lineBreakMode to word wrap, use setAlignment:lineBreakMode: for more control
@property (nonatomic, assign) CGFloat kerning;
@property (nonatomic, assign) CGFloat lineHeight;
+@property (nonatomic, copy) NSString *text;
- (void)setAlignment:(TUITextAlignment)alignment lineBreakMode:(TUILineBreakMode)lineBreakMode;
@@ -238,6 +238,16 @@ - (TUIBackgroundFillStyle)backgroundFillStyle {
return TUIBackgroundFillStyleInline;
}
+- (NSString *)text {
+ return [self string];
+}
+
+- (void)setText:(NSString *)text {
+ [self beginEditing];
+ [self replaceCharactersInRange:NSMakeRange(0, [self length]) withString:[text copy]];
+ [self endEditing];
+}
+
@end
@implementation NSShadow (TUIAdditions)
@@ -449,4 +449,9 @@ - (void)setVerticalAlignment:(TUITextVerticalAlignment)alignment
[self _resetFrame];
}
+- (void)setNeedsDisplay {
+ [self _resetFramesetter];
+ [view setNeedsDisplay];
+}
+
@end

0 comments on commit a8670dc

Please sign in to comment.