I have the following UISearchbar code:
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
NSTimer *myTimer;
NSLog(@"Timer=%@",myTimer);
if (myTimer)
{
if ([myTimer isValid])
{
[myTimer invalidate];
}
myTimer=nil;
}
myTimer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(OnTextChange) userInfo:nil repeats:NO];
}
after writing above code my log shows Timer=null
,
OnTextChange
is method which fetches data from Url.
Thanks in advance !!