UIbutton を押すとコードが要求されます UITextView が表示されます Ì もう一度押します UIbutton が UITextView を再度表示します :/
2 に答える
1
次のようなファイル内のint変数は1つだけ.h
です..
int AddNote;
のようなメソッドで0を割り当てた後viewDidLoad:
..
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];
}
これがあなたを助けることを願っています...
于 2012-12-20T13:46:56.373 に答える
0
の可視性を使用できますUITextView
。
これにより、最初のものが表示され、次に2番目が表示され、両方が非表示になり、再び開始されます。
if (myTextView2.hidden) {
if (myTextView1.hidden) {
myTextView1.hidden = NO;
}
else {
myTextView2.hidden = NO;
}
}
else {
myTextView1.hidden = YES;
myTextView2.hidden = YES;
}
1 つ目と 2 つ目を切り替えるだけの場合は、次のようにします。
if (myTextView1.hidden) {
myTextView1.hidden = NO;
myTextView2.hidden = YES;
}
else {
myTextView1.hidden = YES;
myTextView2.hidden = NO;
}
于 2012-12-20T13:42:49.927 に答える