Reputation: 321
I am trying to connect UITextField to file's owner. Though i have taken
IBOutlet UITextField *txt1
But i am not able to connect the outlet
Can you please suggest what could be wrong?
Upvotes: 0
Views: 1283
Reputation: 5782
I think you have not declared @property
in .h
file and synthesize it..
u may require to declare property in .h file like this:
@property (nonatomic, retain) UITextField *txt1;
and synthesize in .m
file like this..
@synthesize txt1;
make sure "@synthesize txt1
" comes after @implementation
..
I hope that will help according to my knowledge.. :)
Upvotes: 0
Reputation: 1675
Sometimes there is a problem with the class file name. In my case I made a refactory (rename) and forgot to change the custom class attribute for the file's owner, as show in the screen shoot:
Upvotes: 1
Reputation: 9168
From the popup you have open, click and drag from the circle next to New Referencing Outlet
to the File's Owner
. If you can't see an option for txt1
, click on the rightmost of the three buttons above the label View
in the top bar. The right pane will appear In the right pane, click the third icon from the left (on the top), and make sure the Class
under the Custom Class
heading is set to the same class as the file's owner.
Upvotes: 1
Reputation: 69027
My suggestion is checking the type of the file's owner.
It should be exactly the same type as the class where you declared IBOutlet UITextField *txt1
.
Also, ensure that IB knows about the outlet (i.e., it lists it in the outlet pane for your file's owner).
Upvotes: 7