Commit d9c870ab authored by admin's avatar admin

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

parent a15e71b9
......@@ -12,4 +12,6 @@
@property (nonatomic, strong) UIButton *photoButton;
@property (nonatomic, strong) UILabel *photoLabel;
@property (nonatomic, strong) UITextView *titleTextView;
@property (nonatomic, strong) UILabel *placeholderLabel2;
@end
......@@ -10,7 +10,6 @@
@interface AddPicTextTableViewCell () <UITextViewDelegate>
@property (nonatomic, strong) UIImageView *backImageView1;
@property (nonatomic, strong) UILabel *placeholderLabel2;
@property (nonatomic, strong) UIView *lineView;
@end
......@@ -139,7 +138,7 @@
{
if (!_titleTextView) {
_titleTextView = [[UITextView alloc] init];
_titleTextView.delegate = self;
_titleTextView.tag = 99903;
_titleTextView.font = [UIFont systemFontOfSize:15.0];
_titleTextView.translatesAutoresizingMaskIntoConstraints = NO;
[self.backImageView1 addSubview:_titleTextView];
......
......@@ -229,8 +229,15 @@
#pragma mark - UItextView
- (void)textViewDidBeginEditing:(UITextView *)textView
{
self.tableTop.constant = -100;
self.tableBottom.constant = -100;
if (textView.tag == 99903) {
self.tableTop.constant = -200;
self.tableBottom.constant = -200;
} else {
self.tableTop.constant = -100;
self.tableBottom.constant = -100;
}
[UIView animateWithDuration:0.3 animations:^{
[self.tableView layoutIfNeeded];
}];
......@@ -248,7 +255,10 @@
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
AddPictureTableCell *cell = [_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
AddPicTextTableViewCell *cell1 = [_tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:_rowNumber - 2 inSection:0]];
if (![text isEqualToString:@""]) {
cell1.placeholderLabel2.hidden = YES;
if (textView.tag == 9991) {
cell.placeholderLabel1.hidden = YES;
} else {
......@@ -257,6 +267,7 @@
}
if ([text isEqualToString:@""] && range.location == 0 && range.length == 1) {
cell1.placeholderLabel2.hidden = NO;
if (textView.tag == 9991) {
cell.placeholderLabel1.hidden = NO;
} else {
......@@ -267,7 +278,7 @@
if ([text isEqualToString:@"\n"]) {
[cell.titleTextView resignFirstResponder];
[cell.contentTextView resignFirstResponder];
[cell1.titleTextView resignFirstResponder];
if (textView.tag == 9991) {
if (textView.text.length != 0) {
cell.placeholderLabel1.hidden = YES;
......@@ -437,7 +448,8 @@
if (!cell) {
cell = [[AddPicTextTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kAddPicTextTableViewCell];
}
cell.titleTextView.delegate = self;
if (_rowNumber - 2 == _imageNameArray.count) {
if (indexPath.row == _rowNumber - 2) {
......@@ -463,7 +475,6 @@
cell.titleTextView.text = textStr;
}
} else {
if (indexPath.row == _rowNumber - 2) {
[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