gpt4 book ai didi

iphone - 如何在使用动画按下返回键时将新的 UITextField 添加到自定义 UITableViewCell

转载 作者:行者123 更新时间:2023-11-28 22:33:59 24 4
gpt4 key购买 nike

例如在iphone 联系人应用程序中,在添加地址单元格中,当用户在“street”文本字段中键入时,另一个带有占位符“street”的文本字段会添加到当前文本字段下方并带有动画,如何做到这一点?

最佳答案

添加这段代码:

- (BOOL) textFieldShouldReturn:(UITextField *)textField{
CGRect frame = textField.frame;
frame.origin.y = frame.origin.y + frame.size.height + 5;//5 is space between two teftFields
UITextField *newTextField =[[UITextField alloc] initWithFrame:frame];
textField.placeholder = @"street";
[[textField superview] addSubview:newTextField];

return YES;
}

对于动画小东西尝试调整:

[UIView animateWithDuration:(NSTimeInterval)
animations:^{

} completion:^(BOOL finished) {

}];

干杯。

关于iphone - 如何在使用动画按下返回键时将新的 UITextField 添加到自定义 UITableViewCell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16643488/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com