Попробуйте этот код
20 TextFields вы должны принять их в UIScrollView .. вы можете сделать, как это -
UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0,0,320,460)];
[scrollView setDelegate:self];
//initialize a textfield array;
NSMutableArray *textFieldArray = [[NSMutableArray alloc]init];
//x, y for first textfield in UIScrollView
float x = 20;
float y = 20;
For(int i=1;i<21;i++)
{
UITextfield *textField = [[UITextfield alloc]initWithFrame:CGRectMake(x,y,200,30)];
textfield.tag = i;
[textField setDelegate:self];
//Add Textfield to array just for futureRefrence
[textFieldArray addObject:textField];
//Add textfield in UIScrollView
[scrollView addSubview:textField];
//Now iterate Y , So they won't over each other
y = y+50;
}
//Now set ScrollView ContentSize
[scrollView setContentSize:CGSizeMake:(320,20*y)];
//Now Finally Add ScrollView in UIView
[self.view addSubView:scrollView];
Также помните, что объявили делегат в файле .h. и вы можете получить доступ к этому текстовому полю с помощью массива вы положили их, например
Если вы хотите значение из текстового поля три, вы можете сделать, как этот
UITextfield *textfield = (UITextfield *)[textFieldArray objectAtIndex:2];
NSLog(@"text of textField 3 is -- %@",textfield.text);
Я на самом деле не пытался что-либо, потому что я не знаю, как это сделать. – Emil