RATreeView icon indicating copy to clipboard operation
RATreeView copied to clipboard

When loading data from JSON-API, first couple of rows are hidden under navigation bar...

Open kmav opened this issue 9 years ago • 2 comments

I have changed the provided example to use with storyboards and loading data from JSON-API using AFNetworking (asynchronous). I use storyboards and navigation controller. When I click a row of treeview I open a detail view controller using segue

  1. On viewDidLoad I call the API and I set notifications, observers etc.
  2. When API call is successful a notification handler is triggered that does all the treeview setup (in the provided example this is done in viewDidLoad)
  3. The first time data are loaded but first 1-2 rows of treeview are covered by navigation bar
  4. If I select a row, a detail view controller is openning
  5. Going back to treeview, the first 1-2 rows are not lost anymore! They appear as they should be.

I suspected that this might have to do with wrong timing of calling viewWillAppear. I made several tests on that but without success. Even calling the code inside viewWillAppear directly did not solve the issue. When came back from detail view controller it appears the viewWillAppear of the treeview is called...

kmav avatar Jan 31 '16 16:01 kmav

When changing my code to not load data from JSON-API but use inline demo data as in the example, the application works fine.

kmav avatar Jan 31 '16 16:01 kmav

I just encountered with this issue. It has been a while since you opened the issue but let me explain how i solved this in order to help others who might encounter this.

You must not call setuptreeview function when you get answer from the API. Setup operation must be done in viewDidLoad, you just need to change treeView(treeView: RATreeView, numberOfChildrenOfItem item: AnyObject?) function a bit so that it returns 0 when you are waiting your data from the API. When you get your data, set the data and call treeView.reloadData()

firattemel avatar Apr 07 '16 14:04 firattemel