Skip to content

Commit c3da0e1

Browse files
committed
Fix comment reply preview. Thanks @conradev for report.
1 parent 92cfac7 commit c3da0e1

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Classes/Controllers/ComposeController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ - (void)loadView {
189189

190190
textView = [[PlaceholderTextView alloc] initWithFrame:[[self view] bounds]];
191191
[textView setDelegate:self];
192+
[textView setAlwaysBounceVertical:YES];
192193
[textView setFont:[UIFont systemFontOfSize:16.0f]];
193194
[textView setPlaceholder:[self multilinePlaceholder]];
194195
[textView setEditable:[self includeMultilineEditor]];

Classes/Controllers/EntryReplyComposeController.m

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ - (void)loadView {
7979
[replyLabel setFont:[UIFont systemFontOfSize:12.0f]];
8080
[replyLabel setTextColor:[UIColor darkGrayColor]];
8181
[replyLabel setNumberOfLines:0];
82-
[tableView addSubview:replyLabel];
82+
[textView addSubview:replyLabel];
8383
}
8484

8585
- (void)viewDidLoad {
8686
[super viewDidLoad];
8787

8888
if ([entry body] != nil && ![[entry body] isEqualToString:@""]) {
89-
CGFloat replyPadding = 8.0f;
89+
CGFloat replyPadding = 8.0;
9090

9191
NSString *bodyText = [entry body];
9292
bodyText = [bodyText stringByReplacingOccurrencesOfString:@"<p>" withString:@"\n\n"];
@@ -97,9 +97,13 @@ - (void)viewDidLoad {
9797
NSString *replyText = [NSString stringWithFormat:@"%@: %@", [[entry submitter] identifier], bodyText];
9898
[replyLabel setText:replyText];
9999

100-
CGRect replyFrame = CGRectMake(replyPadding, -replyPadding, [tableView bounds].size.width - replyPadding - replyPadding, [tableView bounds].size.height / 3.0f);
101-
replyFrame.size.height = [[replyLabel text] sizeWithFont:[replyLabel font] constrainedToSize:replyFrame.size lineBreakMode:[replyLabel lineBreakMode]].height;
102-
replyFrame.origin.y -= replyFrame.size.height;
100+
CGSize replySize = CGSizeMake([textView bounds].size.width - replyPadding - replyPadding, [textView bounds].size.height / 3.0f);
101+
replySize.height = ceilf([[replyLabel text] sizeWithFont:[replyLabel font] constrainedToSize:replySize lineBreakMode:[replyLabel lineBreakMode]].height);
102+
103+
CGRect replyFrame;
104+
replyFrame.size = replySize;
105+
replyFrame.origin.x = replyPadding;
106+
replyFrame.origin.y = textView.contentInset.top - replyPadding - replyFrame.size.height;
103107
[replyLabel setFrame:replyFrame];
104108
}
105109
}

0 commit comments

Comments
 (0)