2

UITableViewユーザーがテーブルビューがスクロールしていない最後のセルのテキストフィールドをクリックした場合、プレーンスタイルにフッターを追加しました

    -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:   (NSInteger)section{


            UIView *view =[[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 500)];
            [view setBackgroundColor:[UIColor blackColor]];
            return view;
}

これが機能するセクションテーブルの場合、助けてください

4

1 に答える 1

0
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    if(textField == yourTextField){ /// here write name of your Textfield in which you want to scroll tableview
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:0.3];
        yourTableView.frame = CGRectMake(yourTableView.frame.origin.x, -160, yourTableView.frame.size.width, tblContactUS.frame.size.height);
        [UIView commitAnimations];
     }
     return YES;
}

TableViewを前のフレームに配置してから、次のメソッドを使用します

- (BOOL)textFieldShouldReturn:(UITextField *)textField 
{
    [textField resignFirstResponder];
    if(textField == yourTextField){ /// here write name of your Textfield in which you want to scroll down tableview
            [UIView beginAnimations:nil context:nil];
            [UIView setAnimationDuration:0.3];
            yourTableView.frame = CGRectMake(yourTableView.frame.origin.x, 0, yourTableView.frame.size.width, tblContactUS.frame.size.height);
            [UIView commitAnimations];
     }
    return YES;
}

これがお役に立てば幸いです...

于 2012-11-26T07:08:35.963 に答える