I have a scenario when the document takes time to download in a webview , user can press a cancel button provided in the activity indicator and can stop the downloading. I am using a different library for activity indicator. I need to know in webview that the button has been clicked in activity indicator or how can I have access to webview in activity indicator library. Can I set the activity indicator cancel button selector method in some other file? Quick help is much appreciated.
            Asked
            
        
        
            Active
            
        
            Viewed 290 times
        
    2 Answers
1
            
            
        You can either use Delegation or Notification to tell the Class that contains UIWebView that cancel button has been pressed in another class(your Activity Indicator class).
 
    
    
        Puneet Sharma
        
- 9,369
- 1
- 27
- 33
0
            
            
        You can use NSNotificationCenter for get the Cancel button pressed event:
Add Observer
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(cancelButtonClicked:) name:@"cancelButton" object:nil];
Implement Cancel method
-(void)cancelButtonClicked:(NSNotification *)notification{
   // Do your action here
}
And also don't forget to remove observer once done with cancel:
[[NSNotificationCenter defaultCenter] removeObserver:self];
For detail check this one :
Send and receive messages through NSNotificationCenter in Objective-C?
 
    
    
        Community
        
- 1
- 1
 
    
    
        Vinod Singh
        
- 1,374
- 14
- 25
