如果您按下 UIbutton 显示 UITextView,将请求代码 Ì 再次按下 UIbutton 再次显示 UITextView :/
最佳答案
.h
文件中只有一个 int 变量,如下所示..
int AddNote;
在 viewDidLoad:
方法中分配 0 之后,例如..
AddNote = 0;
然后在下面的方法中创建它..
-(IBAction)btnAddTextView:(id)sender
{
UITextView *txtAddNote=[[UITextView alloc]initWithFrame:CGRectMake(AddNote * 180,20, 180, 44)];
[txtAddNote setBackgroundColor:[UIColor scrollViewTexturedBackgroundColor]];
[txtAddNote setFont:[UIFont fontWithName:@"Helvetica-Bold" size:15]];
txtAddNote.layer.borderWidth = 2.0;
txtAddNote.layer.borderColor= [UIColor redColor].CGColor;
AddNote++;
txtAddNote.tag = AddNote;
txtAddNote.userInteractionEnabled= YES;
txtAddNote.delegate = self;
txtAddNote.textColor = [UIColor whiteColor];
// [txtAddNote sizeToFit];
// [txtAddNote setClipsToBounds:YES];
// [viewTxt setClipsToBounds:YES];
[self.view addSubview:txtAddNote];
[txtAddNote release];
}
希望这对您有帮助...
关于ios - 按 UIbutton 显示 UITextView 频繁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13973420/