PDA

View Full Version : Help!!! is there a way to have the text not be editable?




Afbar1114
Sep 10, 2012, 12:18 PM
I dont know if this is the right place but i am trying to build an app. is there a way to have the text not be editable? and is there away to keep the app up to date with events and articles?



ArtOfWarfare
Sep 10, 2012, 12:49 PM
Use UILabels?

dejo
Sep 10, 2012, 01:21 PM
Or disable (.enabled = NO) a UITextField or UITextView.

Duncan C
Sep 10, 2012, 02:33 PM
I dont know if this is the right place but i am trying to build an app. is there a way to have the text not be editable? and is there away to keep the app up to date with events and articles?

For UITextView objects, set the editable property to FALSE.

For UITextField objects, you can use the enabled property it inherits from UIControl. (As mentioned by another poster.)

solderguy1
Sep 10, 2012, 05:02 PM
UITextView also has a popup saying "Copy Paste Select" even if editing is disabled. Subclass and override with this method to remove:


// file MyTextView.h
@interface MyTextView : UITextView
- (BOOL)canBecomeFirstResponder;
@end


// File MyTextView.m
#import "MyTextView.h"
@implementation MyTextView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}

- (BOOL)canBecomeFirstResponder {
return NO;
}
@end