title: Completely disabling UIRefreshControl - iOS
body: <p>I have a tableview that is refreshable with a <code>UIRefreshControl</code>. It works fine.</p>
  
  <p>The catch is that I wish to disable the <code>UIRefreshControl</code> when I click an <code>Edit</code> button (which is a <code>UIBarButton</code>). I am having extreme difficulties in trying to disable <code>UIRefreshControl</code> completely. I've gotten it to the point where the content of my table is definitely not being refreshed (which is good), but the user is still able to pull down and reveal the spinny-symbol, which then displays briefly. Is there any way I can hide this spinny-symbol?</p>
  
  <p>I've tried so many things: <code>refreshControl.endRefreshing()</code>, <code>refreshControl.isHidden = true</code>, <code>refreshControl.removeFromSuperview()</code>, <code>refreshControl = nil</code>...</p>
  
  <p>Here's some of my code. (<code>isInEditMode</code> is an instance variable that is true when <code>Edit</code> is tapped and false when <code>Done</code> is tapped. I am confident that this boolean is set properly, so I don't believe that's the problem.)</p>
  
  <pre><code>func refreshTable(sender: UIRefreshControl) {
  
      if !isInEditMode {
  
          self.refreshControl.beginRefreshing()
          refreshProfile() 
  
      // this works exactly as I want it to
  
      }
  
      else {
          refreshControl.endRefreshing()
          // OR refreshControl.isHidden = true
          // OR refreshControl = nil
          // OR refreshControl.removeFromSuperview()
  
          // refreshProfile() not called, so table doesn't update, but the user can still pull down and the spinny icon shows. I do not want this. 
      }
  
  
  
  }
  </code></pre>
  
  <p>EDIT: I tried all of the solutions set forth in <a href="https://stackoverflow.com/questions/19480424/how-do-i-hide-a-uirefreshcontrol">How do I &quot;hide&quot; a UIRefreshControl?</a>, and none of them solved my issue. It may be because that post is quite old--2013. (Or because something about the way I'm using <code>UIRefreshControl</code> is different. The primary solution set forth in that post is to set the <code>UIRefreshControl</code> to <code>nil</code> after <code>endRefreshing()</code>. This did not work for me. I also tried the hacky solution suggested of setting the tint of the <code>UIRefreshControl</code> to <code>clear</code>. And, as outline above, I also tried <code>isHidden</code> and <code>removeFromSuperview()</code>. Another factor distinguishing my post from that other post is that all of those answers for Objective-C, whereas I am interested in Swift 3. (Although I'm pretty sure I was able to translate the suggestions on that thread to Swift. That's beside the point though, since none of them worked for me.) </p>