Help!!! is there a way to have the text not be editable?

Discussion in 'iOS Programming' started by Afbar1114, Sep 10, 2012.

  1. Afbar1114, Sep 10, 2012
    Last edited by a moderator: Sep 10, 2012

    Afbar1114
    Expand Collapse
    macrumors 6502a

    Joined:
    Jun 18, 2012
    #1
    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?
     
  2. ArtOfWarfare
    Expand Collapse
    macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
  3. dejo
    Expand Collapse
    Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    Or disable (.enabled = NO) a UITextField or UITextView.
     
  4. Duncan C
    Expand Collapse
    macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #4
    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.)
     
  5. solderguy1
    Expand Collapse
    macrumors member

    Joined:
    Apr 20, 2012
    #5
    UITextView also has a popup saying "Copy Paste Select" even if editing is disabled. Subclass and override with this method to remove:


    Code:
    // 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
     

Share This Page