Eureka icon indicating copy to clipboard operation
Eureka copied to clipboard

Custom Header disappearing / not reloading after navigating back from PushRow

Open hou1nxb opened this issue 7 years ago • 9 comments

XCode 9.2 iOS 11 Eureka 4.01

I have a Custom Header from xib file that is displaying fine. But when I load a PushRow, make a selection, and the form comes back into view, the header is blank - no longer displaying the custom header view. If I scroll the form to where the header is off the screen, then scroll back to where header is visible - the custom header shows up again.

Followed the doc:

+++ Section("Unit Data"){ section in var header = HeaderFooterView<TableSectionHeader>(.nibFile(name: "TableSectionHeader", bundle: nil))

                // Will be called every time the header appears on screen
                header.onSetupView = { view, _ in
                    // Commonly used to setup texts inside the view
                    // Don't change the view hierarchy or size here!
                    
                    view.lblTitle.text = "test"
                    
                    
                }
            
                section.header = header
            
            }

EDIT: It appears that the .onSetupView() is NOT being called when the form re-appears after selecting an item from a PushRow. It is being called when I scroll the header off the screen and back into view.

Thank you.

hou1nxb avatar Jan 23 '18 19:01 hou1nxb

@hou1nxb reload tableview on onCellSelection() event of your PushRow

indrajitsinh avatar Jan 25 '18 05:01 indrajitsinh

Thanks for the response. This does in fact fix the header view issue. However, it causes incorrect and unpredictable behavior of the PushRow in question. The item selected may or may not appear on the form after selection.

hou1nxb avatar Jan 30 '18 03:01 hou1nxb

Hello guys,

I have behaviour too, I tried the reloadData() in the onCellSelection, but it doesn't refresh the value of the row. If I remove it, the value of the row is back, but the custom header disappear :(

Is there any fix ? Thank you :)

Edit: I found a workaround to still update it

.onCellSelection { [weak self] _, _ in
    self?.tableView?.reloadData()
}
.onChange { [weak self] _ in
    self?.tableView?.reloadData()
}

gorbat-o avatar Apr 30 '18 17:04 gorbat-o

Hi,

In the end, I still have this issue. :/

When I am scrolling down to hide the header view and release it, it is appearing

gorbat-o avatar May 21 '18 21:05 gorbat-o

same issue here... no updates on this matter ?

adnacacio avatar Sep 24 '18 16:09 adnacacio

Hey @adnacacio My workaround was to separate the tableview from my header and manage both separately :)

gorbat-o avatar Sep 24 '18 16:09 gorbat-o

@adnacacio @gorbat-o Does this still happen? It does not happen when adding a header view in the Example project, so that either it has been fixed or it is related to something else in a FormViewController (not the PushRow itself).

Also, please make sure you always call super when overriding methods

mats-claassen avatar Oct 26 '18 15:10 mats-claassen

I'm having the same issue. Happened when I call reload() in any row under the same form. Also when I call removeAll() under the Section and add some new rows in, the custom section header also disappeared. It only reappear when showing it after hiding the section by scrolling down.

  • I'm using Eureka 4.3.0

kuoliangkwong avatar Feb 15 '19 02:02 kuoliangkwong

Similar situation also happened to me. I can't narrow down the cause (not sure if that happens due to tableview reloadData or set section hidden or shown again)?

But I am able to work around by set the section header again after "evaluateHidden" and before tableview reloadData.

christinachanhk avatar Oct 15 '20 02:10 christinachanhk