您可以使用此代码实现此目的;
int num=yournum;
for (int i = 1; i <= num; i++) {
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(...)];
textField.tag = i;
...
[self.view addSubview:textField];
}
之后要访问正确的文本字段,您需要调用
[self.view viewWithTag:tag]
.