0
我有一个按钮acton与出口btnAdd,当它按下它添加文本字段,我想要移动按钮行动也textfields下面和同样想要恢复时按钮BtnRemove按下,如何将按钮动作沿y轴移动iphone
- (IBAction)btnAddTxtField:(id)sender {
textField = [[UITextField alloc] initWithFrame:CGRectMake(76, ([txtFieldArray count] * 30), 191, 25)];
[textField setBorderStyle:UITextBorderStyleLine];
textField.font = [UIFont systemFontOfSize:20];
textField.placeholder = @"Enter text";
textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.keyboardType = UIKeyboardTypeDefault;
textField.returnKeyType = UIReturnKeyDone;
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
textField.delegate = self;
[myScrollview addSubview:textField];
[txtFieldArray addObject:textField];
CGRect frame = bottomView.frame;
frame.origin.y += textField.frame.size.height + 5;
btnAdd = [[UIButton alloc] initWithFrame:CGRectMake(210, ([txtFieldArray count] *30), 20, 20)];
frame.origin.y += btnAdd.frame.size.height +5;
bottomView.frame = frame;
textField.hidden = NO;
}
你的代码给我错误 – NullData 2013-04-11 09:01:37
有助于知道错误是什么?如果是这样的话,修正一个小的错字。 '(BOOL完成)'后面还有一个^ – 2013-04-11 10:47:11
@QualityCoder最终为您工作了吗?如果有,请接受答案。谢谢。 – 2013-05-12 09:29:37