Question

There are 2 forms in my program. When view controller A gets the focus and be active, view controller B will lost the focus and be inactive. Can anyone show me What the events are?

Thanks

Was it helpful?

Solution

Miken, it depends on what type of objects you are using for your "forms".

The simplest "form" to use is a UITextField, and in that case, events will be sent to your UITextField's delegate. In a lot of simple cases, you will designate the viewController that holds your UITextfield to be the UITextFieldDelegate. For more information on the methods that the delegate has, take a look at this: https://developer.apple.com/library/ios/documentation/uikit/reference/UITextFieldDelegate_Protocol/UITextFieldDelegate/UITextFieldDelegate.html#//apple_ref/occ/intf/UITextFieldDelegate

In this case, when the text field gets the focus (ie the user clicks on the text field to edit it) the delegate methods:

– textFieldShouldBeginEditing:

– textFieldDidBeginEditing:

– textFieldShouldEndEditing:

– textFieldDidEndEditing:

will be called. I'm using this as a basic example, and not assuming too much here, but generally you should be looking into your "forms" delegate methods.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top