|
@@ -50,6 +50,7 @@
|
|
- (void)textViewDidBeginEditing:(UITextView *)textView {
|
|
- (void)textViewDidBeginEditing:(UITextView *)textView {
|
|
self.tipsLabel.hidden = YES;
|
|
self.tipsLabel.hidden = YES;
|
|
}
|
|
}
|
|
|
|
+
|
|
- (void)textViewDidEndEditing:(UITextView *)textView {
|
|
- (void)textViewDidEndEditing:(UITextView *)textView {
|
|
if ([NSString isEmptyString:textView.text]) {
|
|
if ([NSString isEmptyString:textView.text]) {
|
|
self.tipsLabel.hidden = NO;
|
|
self.tipsLabel.hidden = NO;
|
|
@@ -94,26 +95,42 @@
|
|
UITextRange *selectedRange = [textView markedTextRange];
|
|
UITextRange *selectedRange = [textView markedTextRange];
|
|
NSString * newText = [textView textInRange:selectedRange]; //获取高亮部分
|
|
NSString * newText = [textView textInRange:selectedRange]; //获取高亮部分
|
|
if (newText.length>0) {
|
|
if (newText.length>0) {
|
|
|
|
+ UITableView *tableView = [self tableView];
|
|
|
|
+ if (@available(iOS 11.0, *)) {
|
|
|
|
+ [UIView performWithoutAnimation:^{
|
|
|
|
+ [tableView performBatchUpdates:nil completion:nil];
|
|
|
|
+ [tableView sizeToFit];
|
|
|
|
+ }];
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ [UIView performWithoutAnimation:^{
|
|
|
|
+ [tableView beginUpdates];
|
|
|
|
+ [tableView endUpdates];
|
|
|
|
+ }];
|
|
|
|
+ }
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
|
|
|
- [paragraphStyle setLineSpacing:4];//调整行间距
|
|
|
|
- NSMutableAttributedString *attrs = [[NSMutableAttributedString alloc] initWithString:textView.text attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x666666)}];
|
|
|
|
- textView.attributedText = attrs;
|
|
|
|
-
|
|
|
|
- UITableView *tableView = [self tableView];
|
|
|
|
- if (@available(iOS 11.0, *)) {
|
|
|
|
- [UIView performWithoutAnimation:^{
|
|
|
|
- [tableView performBatchUpdates:nil completion:nil];
|
|
|
|
- [tableView sizeToFit];
|
|
|
|
- }];
|
|
|
|
- }
|
|
|
|
else {
|
|
else {
|
|
- [UIView performWithoutAnimation:^{
|
|
|
|
- [tableView beginUpdates];
|
|
|
|
- [tableView endUpdates];
|
|
|
|
- }];
|
|
|
|
|
|
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
|
|
|
+ [paragraphStyle setLineSpacing:4];//调整行间距
|
|
|
|
+ NSMutableAttributedString *attrs = [[NSMutableAttributedString alloc] initWithString:textView.text attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x666666)}];
|
|
|
|
+ textView.attributedText = attrs;
|
|
|
|
+
|
|
|
|
+ UITableView *tableView = [self tableView];
|
|
|
|
+ if (@available(iOS 11.0, *)) {
|
|
|
|
+ [UIView performWithoutAnimation:^{
|
|
|
|
+ [tableView performBatchUpdates:nil completion:nil];
|
|
|
|
+ [tableView sizeToFit];
|
|
|
|
+ }];
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ [UIView performWithoutAnimation:^{
|
|
|
|
+ [tableView beginUpdates];
|
|
|
|
+ [tableView endUpdates];
|
|
|
|
+ }];
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
- (UITableView *)tableView {
|
|
- (UITableView *)tableView {
|
|
UIView *tableView = self.superview;
|
|
UIView *tableView = self.superview;
|