Sub Class_Globals
Private CSB As CSBuilder
Private cb As Object
Private en As String
Private RefreshControl As NativeObject
End Sub
Public Sub Initialize(callback As Object, EventName As String, sv As ScrollView)
cb = callback
en=EventName
Dim no As NativeObject=Me
RefreshControl = no.RunMethod("AddRefresh:",Array(sv))
RefreshControl.SetField("attributedTitle",CSB.Initialize.Append("Pull to refresh").PopAll) 'You can add AttributedString
End Sub
Public Sub EndRefreshing
RefreshControl.RunMethod("endRefreshing",Null)
RefreshControl.SetField("attributedTitle",CSB.Initialize.Append("Pull to refresh").PopAll) 'You can add AttributedString
End Sub
Private Sub RC_Refresh(RC As Object)
RefreshControl.SetField("attributedTitle",CSB.Initialize.Append("Refreshing...").PopAll) 'You can add AttributedString
CallSub(cb, en&"_PullRefresh")
End Sub
#If OBJC
-(UIRefreshControl *)AddRefresh: (UIScrollView*)scrollView {
UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[scrollView addSubview:refreshControl];
[refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
return refreshControl;
}
- (void)refresh:(id)sender {
UIRefreshControl *refreshControl=sender;
[self.bi raiseEvent:nil event:@"rc_refresh:" params:@[(refreshControl)]];
}
#end if