UITextField を作成するための配列があります。しかし、UITextField は同じフレームに残りますか?これが私のコードです。ボタンを押すと、新しい UITextField が作成されます。
-(IBAction)textFieldcreating{
textfieldform = [[NSMutableArray alloc] init];
textField1 = [[UITextField alloc] initWithFrame:CGRectMake(10, 10, 100, 40)];
textField1.borderStyle = UITextBorderStyleRoundedRect;
textField1.font = [UIFont systemFontOfSize:15];
textField1.placeholder = @"enter text";
textField1.autocorrectionType = UITextAutocorrectionTypeNo;
textField1.keyboardType = UIKeyboardTypeDefault;
textField1.returnKeyType = UIReturnKeyDone;
textField1.clearButtonMode = UITextFieldViewModeWhileEditing;
textField1.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
textField1.delegate = self;
[textfieldform addObject:textField1];
int counter;
counter = 0;
if(counter < [textfieldform count])
{
textField1.frame = CGRectMake(textField1.frame.origin.x+30, textField1.frame.origin.x+40, textField1.frame.size.width+40, textField1.frame.size.height+50);
[self.view addSubview:textField1];
counter++;
}
}