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