UITextView created programmatically, allowing selection but no edit, ios6+
UITextView created programmatically, allowing selection but no edit, ios6+
- Subject: UITextView created programmatically, allowing selection but no edit, ios6+
- From: Devarshi Kulshreshtha <email@hidden>
- Date: Tue, 15 Oct 2013 20:48:33 -0500
I am trying to create a UITextView programmatically using below code:
- (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;
}
I am trying to achieve following thing:
> UITextView should be selectable but un-editable.
My problems are:
1. I tried to set selectable property as YES, but it crashed on iOS6.
2. I tried to set it as editable, but neither I was able to select the
text, nor it showed any keyboard to edit it.
2. I tried to set allowsEditingTextAttributes as YES, but neither I was
able to select the text, nor it showed any keyboard to edit it.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden