iOS Question Refresh sub for multiple webviews

frenkipi

Member
Licensed User
Longtime User
Hello, I would like to add a name of web view in the refresh sub, but I don't know how to return a param with OBJC. Am I on the right track?

Bellow is my code.

B4X:
Public Sub AddRefresh (WebView As WebView, NameOfWebView as string)
   Dim no As NativeObject = Me
   no.RunMethod("AddRefresh:",Array(WebView, NameOfWebView))
End Sub

Sub refreshing(RefreshControl As Object, NameOfWebView)
 
  ' DO YOUR REFRESHING JOB

 if NameOfWeb == "test" then

end if

  Dim no As NativeObject = RefreshControl
  no.RunMethod("endRefreshing", Null)  ' END REFRESHING
End Sub

#IF OBJC

-(void)AddRefresh: (UIWebView*)webView {
  UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
  [webView.scrollView addSubview:refreshControl];
  [refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];

}

- (void)refresh:(id)sender {
  UIRefreshControl *refreshControl=sender;
  [self.bi raiseEvent:nil event:@"refreshing:" params:@[(refreshControl)]];

}

#END IF
 
Top