开发者

Xcode : textfield redirects to nib

开发者 https://www.devze.com 2023-02-16 23:52 出处:网络
I have an app that explains terms.They are all explained in nib files.For example, the word \"car\". The user has to search for the word \"car\".

I have an app that explains terms. They are all explained in nib files. For example, the word "car". The user has to search for the word "car".

I want to have a text field. In that text field the user can type the word "car" and it will go to the nib file : "car". How do 开发者_开发问答I do that?

It's like app where you can type an question in a text field and it will answer you in a nib file if you write the question correctly.


1) declare a new IBAction called lookForTerm: in an objrct (eg appDelegate) 2) in the .m file add this method:

-(IBAction)lookForTerm:(id)sender { UiTextField* field = sender; if ([[field text] isEqualToString:@"car"]) { Load your nib } }

3) connect in the interface builder the action with your textfield

0

精彩评论

暂无评论...
验证码 换一张
取 消