Understanding Code Execution


#1

I placed some breakpoints in the code to help me understand how the code is executed. The following describes my understanding of the code execution. Please enlighten me where I do not understand correctly.

After the program is initiated the -(id)initWithNibName method is executed and then -(void)viewDidLoad is executed. I then type in the text for the annotation and select “Done”. This initiates the -(BOOL)textFieldShouldReturn:(UITextField *)textField method. The first line of code in this method is [self findLocation]. This causes the program to go to -(void)findLocation where each line of the code for this method is stepped through. However, these messages (methods) don’t appear to be executed until after the -(BOOL)textFieldShouldReturn:(UITextField *)textField method is finished. At that time it appears that the methods from -(void)findLocation are all executed simultaneously, I see the activityIndicator spinning and the locationTitleField is hidden while the - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations method is executing.

It is my understanding that the methods associated with the objects in -(void)findLocation are not executed until after “Done” is selected. It appears that resignFirstResponder must be executed prior to any other methods being executed. Am I correct in that all of the methods in -(void)findLocation are being executed simultaneously? Is this possible because the code knew that all these messages should be sent following resignation of the textField as the FirstResponder?