Hello, I´m trying to deal with activityIndicator in my iPhone app..But it doesn´t work at all. Inside my project I have a UISearchbar. When people put the keyword and click the search result will show string in UIWEbview. I really want the activity indicator show and animate while waiting for data and Stop when data is loaded. Here is some of the code I use :
@implementation myFirstappController @synthesize myWebview, activityIndicator;
(void)webViewDidStartLoad:(UIWebView *)myWebview {
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES; [activityIndicator startAnimating]; }
(void)webViewDidFinishLoad:(UIWebView *)myWebview {
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO; [activityIndicator stopAnimating]; }
///Here is code inside the UISearchbar
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
NSString *keywords = searchBar.text; NSString *infos = [NSString stringWithFormat: @"%@", keywords]; NSString *rs=nil;
if ([infos isEqualToString:@"Iloveyou"]){ rs =@"I love you too -rte,-rt ;
[myWebview loadHTMLString:rs baseURL:nil]; }
- (void)dealloc { [myWebview release]; //<-------JUST FILL THIS LINE********************** [activityIndicator release]; [searchBar release]; [super dealloc]; }
@end