UA-17470720-3

Jump to content


Photo
- - - - -

Pull to refresh


  • Please log in to reply
2 replies to this topic

#1 Bounty

Bounty

    Experienced Member

  • STV 4.0 Pro
  • PipPipPipPip
  • 64 posts
  • LocationNetherlands
Reputation: 11
Good

Posted 17 April 2015 - 07:00 AM

What is the relation between Pull to refresh in the storyboard and in STV? 

 

Enabling or disabling refreshing (storyboard > attributes inspector), seems to have no effect on STV's functionality. As a matter if fact, the refreshControl in the storyboard seems completely disfunctional. 

 

What I would like is to replace the default behaviour by my own (collect data from some source first, then refresh the table).  This means the default STV behaviour should not be executed, or should be executed after my own data pull has succeeded. 

 

I can (almost) get this done by adding a target action to the STV refreshControl. What I got so far:

 

    override func viewDidLoad() {

        ...        

        self.tableViewModel.enablePullToRefresh = true

        self.tableViewModel.refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)

    }

 

    @IBAction func refresh(sender: AnyObject) {

        // Fetch my own stuff first...

        

        // ...then continue with STV's default behaviour to reload the table

    }

 

Ideally I would like to visually code it in the storyboard by enabling the tab;e's refresh, adding a target to the storyboard's refresh control and call stove's default code to be executed from my own implementation (after I did what I need to do myself).


Edited by Bounty, 20 April 2015 - 04:36 AM.

  • wizgod likes this

#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 20 April 2015 - 04:34 AM

Hi Bounty,

 

Thank you very much, this has been added to our bug fix list. For the time being, please do the following:

 

a. Set 'self.tableViewModel.enablePullToRefresh = true'.

 

b. Implement the didRefresh model action:

 

modelActions.didRefresh =
{
    (tableModel) in

    NSLog("The model has been refreshed.")
}

 

 

Hope this helps.



#3 Bounty

Bounty

    Experienced Member

  • STV 4.0 Pro
  • PipPipPipPip
  • 64 posts
  • LocationNetherlands
Reputation: 11
Good

Posted 20 April 2015 - 04:41 AM

Thanks for putting it on your list and for the suggestion to add a didRefresh. 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users