Reputation: 526
I'm new to Xamarin iOS development and we are having a legacy code in which they have created all tableview using DialogViewController. ViewController hierarchy is as below: PQR derived from ABC and ABC is derived from DialogViewController. And now I want to show refreshControl for PQR view controller which holds object for ABC.
I've created a object of ABC view controller in PQR view controller.
abcDVC = new ABCDVC (this);
tableRefreshControl = new UIRefreshControl ();
if (IsIOS10OrGreater)
abcDVC.RefreshControl = tableRefreshControl;
tableRefreshControl.ValueChanged += LoadNotesAsync;
I'm not getting any single error. But my refreshControl is not visible when table is pull down by user. It was working previously and stop working now.
Thank you in advance.
Upvotes: 1
Views: 159
Reputation: 526
Able to figure out the root cause of it. RefreshControl API work iOS 10 and above. So to add refreshControl to iOS version < iOS 10 we have add refreshControl as subView to UITableView.
tableRefreshControl = new UIRefreshControl();
tableRefreshControl.AddTarget((sender, args) => GetData(), UIControlEvent.ValueChanged);
if (IsIOS10OrGreater)
{
abcDVC.TableView.RefreshControl = tableRefreshControl;
} else {
TableView.AddSubview(tableRefreshControl);
}
Upvotes: 1