我正在尝试使用以下代码以编程方式创建UITextView:
- (void)setupTextView
{
if (!_logDetailView) {
CGSize viewSize = self.view.bounds.size;
CGRect frame =CGRectMake(0.0f,2.0f , viewSize.width, viewSize.height);
_logDetailView =[[UITextView alloc]initWithFrame:CGRectIntegral(frame)];
_logDetailView.backgroundColor=kEMCColor_Clear_Color;
_logDetailView.showsHorizontalScrollIndicator = NO;
// _logDetailView.editable = YES; // tried setting this but didn't work
// _logDetailView.selectable = YES; // crashing on ios 6
_logDetailView.userInteractionEnabled = YES;
_logDetailView.autoresizingMask =UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleBottomMargin;
// _logDetailView.allowsEditingTextAttributes = YES; // tried setting this but didn't work
[self.view addSubview:_logDetailView];
}
_logDetailView.attributedText = self.attributedDataString;
}
我正在努力实现以下目标:
UITextView应该是可选择的但不可编辑。
我的问题是: