• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to enable/disable a UITextField or UITextView programmatically?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to enable/disable a UITextField or UITextView programmatically?


  • Subject: How to enable/disable a UITextField or UITextView programmatically?
  • From: William Squires <email@hidden>
  • Date: Wed, 13 Jan 2010 20:22:07 -0600

I have a UITableView that's part of a Navigation-based Application. There's one .xib, a DrinkDetailViewController class (.m & .h files) and an AddDrinkViewController class which inherits from DrinkDetailViewController. Both share the same view, which contains a UITextField, two UITextViews, and some UILabels. The DrinkDetailViewController.h declares three IBOutlets as follows:

#import <UIKit/UIKit.h>

@interface DrinkDetailViewController : UIViewController
{
IBOutlet UITextField *nameField;
IBOutlet UITextView *ingredientsView;
IBOutlet UITextView *directionsView;
...
}

@end

so that I can access the UITextField, and the two UITextViews. IB shows in the inspector window, that the UITextField, and UITextViews have a BOOL enabled property (controlled by a checkbox labeled "Enabled"). But the following doesn't work:

...
nameField.enabled = YES;
ingredientsView.enabled = YES;
directionsView.enabled = YES;
...

in the viewDidLoad: method of AddDrinkViewController. I unchecked the enabled box for these controls as the normal use of the view is just to display drink information, not for data entry. The AddDrinkViewController re-uses the view for data entry, and I want to re-enable the fields, but only when the view (xib) is used/loaded by the AddDrinkViewController. I looked in the docs for UITextField, but didn't even see a reference to an enabled property. Is this another of those view-within-a-view problems?

_______________________________________________

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


  • Follow-Ups:
    • Re: How to enable/disable a UITextField or UITextView programmatically?
      • From: "Henry McGilton (Boulevardier)" <email@hidden>
  • Prev by Date: Re: Analyzer in error?
  • Next by Date: Re: How to enable/disable a UITextField or UITextView programmatically?
  • Previous by thread: RE: Analyzer in error?
  • Next by thread: Re: How to enable/disable a UITextField or UITextView programmatically?
  • Index(es):
    • Date
    • Thread