我正在使用下面的代码在我的代码中使用textview

UITextView *ObservationTextView3=[[UITextView alloc]init];
ObservationTextView3.frame=CGRectMake(45, ObservationLabel3.frame.origin.y+ObservationLabel3.frame.size.height, 410, 70);
[ObservationTextView3 setKeyboardType:UIKeyboardTypeDefault];
ObservationTextView3.font=[UIFont fontWithName:@"Helvetica" size:14];
ObservationTextView3.delegate=self;
ObservationTextView3.tag=139;
ObservationTextView3.text = @"";
ObservationTextView3.layer.borderWidth=1.0f;
ObservationTextView3.layer.borderColor=[UIColor lightGrayColor].CGColor;
ObservationTextView3.layer.cornerRadius=4.0f;
[_BeverageRoutineScroll addSubview:ObservationTextView3];

但是我无法使此textview响应,我已经尝试了很多事情,但是每时每刻都在进步。

请帮帮我。

最佳答案

试试这个:

[self.view bringSubviewToFront:yourTextView];

[self.view sendSubViewToBack:yourScrollview];

要么
[self.yourScrollView setUserInteractionEnabled:YES];

[self.yourTextView setUserInteractionEnabled:YES];

要么

检查您的scrollView的内容大小和文本视图框架

关于ios - UITextView没有响应,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20258908/

10-10 20:33