在我的项目中,我使用操作表按钮创建了文本字段。第一次创建后如何禁用用户界面。
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex==0)
{
text1 = [[UITextField alloc] initWithFrame:CGRectMake(x2,y2+3, 300, 25)];
text1.backgroundColor = [UIColor whiteColor];
text1.clearButtonMode = UITextFieldViewModeWhileEditing;
text1.font = [UIFont systemFontOfSize:15.0f];
text1.placeholder=@"ENTER HOME LOAN INTEREST";
[text1 setKeyboardType:UIKeyboardTypeNumberPad];
text1.textAlignment=NSTextAlignmentCenter;
text1.userInteractionEnabled=YES;
[scrollview addSubview:text1];
scrollview.contentSize=CGSizeMake(self.view.frame.size.width,self.view.frame.size.height+to);
to+=to;
y2+=30;
img6.frame=CGRectMake(0, y2+4, 320, 60);
y2=y2+62;
img7.frame=CGRectMake(0, y2+5, 320, 60);
y2=y2-62;
}
else if (buttonIndex==1)
{
text2 = [[UITextField alloc] initWithFrame:CGRectMake(x2, y2+3, 300, 25)];
text2.backgroundColor = [UIColor whiteColor];
text2.clearButtonMode = UITextFieldViewModeWhileEditing;
text2.font = [UIFont systemFontOfSize:15.0f];
text2.placeholder=@"ENTER EDUCATION EXPENSE";
[text2 setKeyboardType:UIKeyboardTypeNumberPad];
text2.userInteractionEnabled=YES;
text2.textAlignment=NSTextAlignmentCenter;
[scrollview addSubview:text2];
scrollview.contentSize=CGSizeMake(self.view.frame.size.width,self.view.frame.size.height+to);
to+=to;
y2+=30;
img6.frame=CGRectMake(0, y2+4, 320, 60);
y2=y2+60;
img7.frame=CGRectMake(0, y2+5, 320, 60);
y2=y2-60;
}
}
如何防止用户多次创建相同的文本字段