Based on http://stackoverflow.com/questions/12497940/uirefreshcontrol-without-uitableviewcontroller
Add a UIRefreshControl to your TableView or ScrollView
TABLEVIEW
SCROLLVIEW
Add a UIRefreshControl to your TableView or ScrollView
TABLEVIEW
B4X:
Public Sub AddRefresh (TableView As TableView)
Dim nome as NativeObject=Me
nome.RunMethod("AddRefresh:",Array(TableView))
End Sub
Sub refreshing(RefreshControl As Object)
' DO YOUR REFRESHING JOB
Dim no As NativeObject=RefreshControl
no.RunMethod("endRefreshing",Null) ' END REFRESHING
End Sub
#IF OBJC
-(void)AddRefresh: (UITableView*)tbl {
UITableViewController *tableViewController = [[UITableViewController alloc] init];
tableViewController.tableView = tbl;
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
tableViewController.refreshControl = refreshControl;
}
- (void)refresh:(id)sender {
UIRefreshControl *refreshControl=sender;
[self.bi raiseEvent:nil event:@"refreshing:" params:@[(refreshControl)]];
}
#END IF
SCROLLVIEW
B4X:
Public Sub AddRefresh (ScrollView as ScrollView)
Dim nome as NativeObject=Me
nome.RunMethod("AddRefresh:",Array(ScrollView))
End Sub
Sub refreshing(RefreshControl As Object)
' DO YOUR REFRESHING JOB
Dim no As NativeObject=RefreshControl
no.RunMethod("endRefreshing",Null) ' END REFRESHING
End Sub
#IF OBJC
-(void)AddRefresh: (UIScrollView*)scrollView {
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[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
Last edited: