tags:

views:

11

answers:

1

i have a UITextView object which i have created in interface builder with it's hidden property unmarked.Now i want this textView to be invisible when my application launches and first view appears.Further i want it to be displayed when a particular method is called.Now this is what i have written in view did load

[mTextView setHidden:YES];

self.mTextView=[[UITextView alloc] init];

it hides the textView ats the first view appears but when my desired method is called and i write

[mTextView setHidden:NO]; it does not show it again.. Is it like we cant change the appearance of a textView once it is assigned because after assigning memory as

self.mTextView=[[UITextView alloc] init]; and then writing

[mTextView setHidden:YES];

it does not hide textView in viwDidLoad either.....

+1  A: 

you need to add it in your main view

i.e.

[self.view addSubView:mTextView];

(After initializing it )

and also interchange these 2 lines

[mTextView setHidden:YES];

self.mTextView=[[UITextView alloc] init];

so your code would be

 self.mTextView=[[UITextView alloc] init];
[mTextView setHidden:YES];
[self.view addSubView:mTextView];
mihirpmehta