Commit d9c870ab authored by admin's avatar admin

修改 新增口碑 键盘遮挡输入框

parent a15e71b9
...@@ -12,4 +12,6 @@ ...@@ -12,4 +12,6 @@
@property (nonatomic, strong) UIButton *photoButton; @property (nonatomic, strong) UIButton *photoButton;
@property (nonatomic, strong) UILabel *photoLabel; @property (nonatomic, strong) UILabel *photoLabel;
@property (nonatomic, strong) UITextView *titleTextView; @property (nonatomic, strong) UITextView *titleTextView;
@property (nonatomic, strong) UILabel *placeholderLabel2;
@end @end
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
@interface AddPicTextTableViewCell () <UITextViewDelegate> @interface AddPicTextTableViewCell () <UITextViewDelegate>
@property (nonatomic, strong) UIImageView *backImageView1; @property (nonatomic, strong) UIImageView *backImageView1;
@property (nonatomic, strong) UILabel *placeholderLabel2;
@property (nonatomic, strong) UIView *lineView; @property (nonatomic, strong) UIView *lineView;
@end @end
...@@ -139,7 +138,7 @@ ...@@ -139,7 +138,7 @@
{ {
if (!_titleTextView) { if (!_titleTextView) {
_titleTextView = [[UITextView alloc] init]; _titleTextView = [[UITextView alloc] init];
_titleTextView.delegate = self; _titleTextView.tag = 99903;
_titleTextView.font = [UIFont systemFontOfSize:15.0]; _titleTextView.font = [UIFont systemFontOfSize:15.0];
_titleTextView.translatesAutoresizingMaskIntoConstraints = NO; _titleTextView.translatesAutoresizingMaskIntoConstraints = NO;
[self.backImageView1 addSubview:_titleTextView]; [self.backImageView1 addSubview:_titleTextView];
......
...@@ -229,8 +229,15 @@ ...@@ -229,8 +229,15 @@
#pragma mark - UItextView #pragma mark - UItextView
- (void)textViewDidBeginEditing:(UITextView *)textView - (void)textViewDidBeginEditing:(UITextView *)textView
{ {
self.tableTop.constant = -100; if (textView.tag == 99903) {
self.tableBottom.constant = -100; self.tableTop.constant = -200;
self.tableBottom.constant = -200;
} else {
self.tableTop.constant = -100;
self.tableBottom.constant = -100;
}
[UIView animateWithDuration:0.3 animations:^{ [UIView animateWithDuration:0.3 animations:^{
[self.tableView layoutIfNeeded]; [self.tableView layoutIfNeeded];
}]; }];
...@@ -248,7 +255,10 @@ ...@@ -248,7 +255,10 @@
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{ {
AddPictureTableCell *cell = [_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]]; AddPictureTableCell *cell = [_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
AddPicTextTableViewCell *cell1 = [_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:_rowNumber - 2 inSection:0]];
if (![text isEqualToString:@""]) { if (![text isEqualToString:@""]) {
cell1.placeholderLabel2.hidden = YES;
if (textView.tag == 9991) { if (textView.tag == 9991) {
cell.placeholderLabel1.hidden = YES; cell.placeholderLabel1.hidden = YES;
} else { } else {
...@@ -257,6 +267,7 @@ ...@@ -257,6 +267,7 @@
} }
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) { if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
cell1.placeholderLabel2.hidden = NO;
if (textView.tag == 9991) { if (textView.tag == 9991) {
cell.placeholderLabel1.hidden = NO; cell.placeholderLabel1.hidden = NO;
} else { } else {
...@@ -267,7 +278,7 @@ ...@@ -267,7 +278,7 @@
if ([text isEqualToString:@"\n"]) { if ([text isEqualToString:@"\n"]) {
[cell.titleTextView resignFirstResponder]; [cell.titleTextView resignFirstResponder];
[cell.contentTextView resignFirstResponder]; [cell.contentTextView resignFirstResponder];
[cell1.titleTextView resignFirstResponder];
if (textView.tag == 9991) { if (textView.tag == 9991) {
if (textView.text.length != 0) { if (textView.text.length != 0) {
cell.placeholderLabel1.hidden = YES; cell.placeholderLabel1.hidden = YES;
...@@ -437,7 +448,8 @@ ...@@ -437,7 +448,8 @@
if (!cell) { if (!cell) {
cell = [[AddPicTextTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kAddPicTextTableViewCell]; cell = [[AddPicTextTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kAddPicTextTableViewCell];
} }
cell.titleTextView.delegate = self;
if (_rowNumber - 2 == _imageNameArray.count) { if (_rowNumber - 2 == _imageNameArray.count) {
if (indexPath.row == _rowNumber - 2) { if (indexPath.row == _rowNumber - 2) {
...@@ -463,7 +475,6 @@ ...@@ -463,7 +475,6 @@
cell.titleTextView.text = textStr; cell.titleTextView.text = textStr;
} }
} else { } else {
if (indexPath.row == _rowNumber - 2) { if (indexPath.row == _rowNumber - 2) {
[cell.photoButton setImage:[UIImage imageNamed:@"add-photo_icon"] forState:UIControlStateNormal]; [cell.photoButton setImage:[UIImage imageNamed:@"add-photo_icon"] forState:UIControlStateNormal];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment