Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

asifpv

macrumors newbie
Original poster
Apr 13, 2009
11
0
Hi All,

In my view am dynamically calling UITextView or UITextField. After calling any one view , when i call the other view both are displaying..ie. am not able to disable my UITextView( for which i have larger view than UITextField). Anyone knowing this please help me...

- (void)viewWillAppearBOOL)animated {

[super viewWillAppear:YES];

self.title = [self.keyOfTheFieldToEdit capitalizedString];

NSString* kk = self.keyOfTheFieldToEdit;

if(kk == @"firstName" || kk == @"lastName" || kk == @"email") {

CGRect frame = CGRectMake(20.0, 68.0, 280.0, 31.0);
UITextField *aTextField = [[UITextField alloc] initWithFrame:frame];
self.textField2 = aTextField;
[aTextField release];
textField2.textAlignment = UITextAlignmentCenter;
textField2.borderStyle = UITextBorderStyleRoundedRect;
textField2.autocapitalizationType = UITextAutocapitalizationTypeWords;
textField2.keyboardType = UIKeyboardTypeNamePhonePad;
textField2.returnKeyType = UIReturnKeyDone;
textField2.delegate = self;
[self.view addSubview:textField2];

textField2.text = self.editValue;

[textField2 becomeFirstResponder];

}
else if(kk == @"note") {

self.textField2.enabled = NO;

CGRect frame = CGRectMake(20.0, 60.0, 280.0, 120.0);
UITextView *aTextView = [[UITextView alloc] initWithFrame:frame];
self.textView = aTextView;
[aTextView release];
textView.backgroundColor = [UIColor whiteColor];
textView.keyboardType = UIKeyboardTypeNamePhonePad;
textView.returnKeyType = UIReturnKeyDone;
textView.delegate = self;
[self.view addSubview:textView];

textView.text = self.editValue;

[textView becomeFirstResponder];
}

here after calling my else if part, when we call if part both are displaying...

when we call else if part after if ,then it is overlapping, so in view there is no problem..

Asif
 

jnic

macrumors 6502a
Oct 24, 2008
567
0
Cambridge
Code:
view.enabled = NO;
doesn't stop views from appearing, it just prevents the user interacting with them. You want:

Code:
view.hidden = YES
 

asifpv

macrumors newbie
Original poster
Apr 13, 2009
11
0
Hi Jnic,

Thanx for your reply, can you pleas explain how can i dynamically make my UITextView or UITextField hidden. Now after i giving view.hidden = YES , my view not displaying anything...please help me..

ie. based on my selection (firstName, lastName, or note) from one view i want to display in my editView TexField or textView.

thanks,
asif
 

jnic

macrumors 6502a
Oct 24, 2008
567
0
Cambridge
I meant "view" as a placeholder for whatever you want to hide, for intance:

Code:
textView.hidden = YES;

would hide your text view, etc.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.