I have a UITableViewController in my project and set the "Refreshing" to enabled in Storyboard. However, the outlet of that is nil.
Using it like this
self.refreshControl
Even if I make I custom outlet from the storyboard to the viewcontrolelr it is nil. It works for other table views in my project, just not for this.
Is there anything quick I probably have missed?
Select your TableViewController in the storyboard and enable refreshing. As depicted in the attached image. I hope this would help.
you created via storyboard fine. try once remove from storyboard and add it again.
then initiate that in your viewDidLoad
Method
like self.refreshControl = UIRefreshControl()
or you can create programatically it will be easy.
create one global Property
var refreshControl : UIRefreshControl?
in viewDidLoad Add
self.refreshControl = UIRefreshControl()
if let refreshControl = self.refreshControl{
refreshControl.addTarget(self, action: #selector(viewCtrl.refresh(_:)), forControlEvents: UIControlEvents.ValueChanged)
self.Tableview.addSubview(refreshControl)
}
This will fix your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With