In a method, i start the UIActivityIndicatorView to start. and then use NSXMLParser to get the node information from the XML with synchronization. After finished parse, i want stop the UIActivityIndicatorView. My propose is to appear the UIActivityIndicatorView when parse the XML, but it doesn't work. Any ideas? Thanks.
- (void)ButtonTouch{
[activityIndicator startAnimating];
/*get the login result*/
loginXMLDealer *loginxmldealer = [[loginXMLDealer alloc] init];
loginxmldealer.username = usernameField.text;
loginxmldealer.password = passwordField.text;
[loginxmldealer loginResult];
[activityIndicator stopAnimating];
if ([loginxmldealer.rspCode isEqualToString: @"0001"]) {
UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please check your passport." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[errorAlert show];
[errorAlert release];
}
else {
[self presentModalViewController:self.dataMainController animated:YES];
}
[loginxmldealer release];
}