5

I have UItableview and active UIRefreshControl for pull to refresh action. So I am trying to disable bounce (that appears when I scroll UITableView) by unselecting "bounce" property of tableview in storyboard. But when I do this pull to refresh also stops working. What can I do about this? Should I manually disable only bottom bounce and left top bounce for UIRefreshControl ?

My viewDidLoad method:

override func viewDidLoad() {
    super.viewDidLoad()

    self.refreshControl = UIRefreshControl()
    self.refreshControl!.attributedTitle = NSAttributedString(string: "Обновление")
    self.refreshControl!.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
    self.edgesForExtendedLayout = UIRectEdge.None;
    tableView.allowsMultipleSelectionDuringEditing = false;
    tableView.tableFooterView = UIView()
    // menu button
    if self.revealViewController() != nil {
        menuButton.target = self.revealViewController()
        menuButton.action = "revealToggle:"
        self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())
    }
}
Vijay
  • 791
  • 1
  • 8
  • 23
Panich Maxim
  • 1,105
  • 1
  • 15
  • 34
  • Can you share your code here? Because we don't need to set frame or start to `UITableView` or `UICollectionView`. Just adding `UIRefreshControl` will work like charm. – Vijay Oct 27 '15 at 11:59
  • I added the code for viewDidLoad and also I have unchecked bounce property in storyboard – Panich Maxim Oct 27 '15 at 12:03
  • Why you want to disable the bounce of tableview? Is pull to refresh view appears behind that? – Vijay Oct 27 '15 at 12:06
  • Bcs it is ugly and I also have slide menu that doesn't interact well with bouncing (slide menu is waiting until bouncing will end and only after that I can detect pan gesture and open menu). Pull to refresh doesn't appear when bouncing is off. – Panich Maxim Oct 27 '15 at 12:18
  • Is your refresh control added on table view? – Vijay Oct 27 '15 at 12:19
  • Yes, it works fine if bounce is not disable – Panich Maxim Oct 27 '15 at 12:30
  • By definition, the pull to refresh uses the "bounce" to work.. cannot live without that. – Marc-Alexandre Bérubé Oct 27 '15 at 12:33
  • I think you need to concentrate on the issues which happens when bounce is not disabled. Without bounce property refresh control can't identify its call.. – Vijay Oct 27 '15 at 12:46
  • I get it, thanks, u can add this answer and I will accept it – Panich Maxim Oct 27 '15 at 12:47

1 Answers1

2

I faced the same issue. After implementing some code, I got a result that -unfortunately- the refresh control won't get called without letting the tableView bouncing.

Ahmad F
  • 30,560
  • 17
  • 97
  • 143