Giter VIP home page Giter VIP logo

Comments (10)

DigitalVanilla avatar DigitalVanilla commented on June 3, 2024

A note: if I extend a UITableViewCell, the problem occur and scrolling seems to fix this, but if I extend a UIView the problem does not appear, so something is in the UITableViewCell class extension that interfere the first time the section is attach.

from eureka.

mats-claassen avatar mats-claassen commented on June 3, 2024

So you mean this only appears when you subclass UITableViewCell? Are you doing that with your header view class (aka EKHeaderClass)? That should not subclass from UITableViewCell. Subclassing from UIView is correct

from eureka.

DigitalVanilla avatar DigitalVanilla commented on June 3, 2024

So you mean this only appears when you subclass UITableViewCell?
Yes I wanted to reuse a row class

Are you doing that with your header view class (aka EKHeaderClass)
Yes

Subclassing from UIView is correct
But the cell is visible initially and I see that it disappear when the row animation ends, and why scrolling shows it back?
Can I load a xib file and then assign the .contentview to the section.header? I wish to be clever and reuse the rows we have created for both rows and headers, in this way we have less classes to maintain.

from eureka.

mats-claassen avatar mats-claassen commented on June 3, 2024

Have you tried using UITableViewCell subclasses as headers of a UITableView without Eureka? I wouldn't be surprised if there is some added logic in UITableViewCell that is responsible for this.

What I would do in such a case is design a UIView with common design and use that inside both a row and a header, instead of trying to use a cell as header, but maybe it works

from eureka.

DigitalVanilla avatar DigitalVanilla commented on June 3, 2024

Yes, I did use subclassing the headers without having problems. At the moment I cannot put more time and money on this update to use a UIView custom class inside the headers, I wanted to re-use Eureka Custom Class (not the row) to be clever and have one class that does both things (header and regular row). But the point is that the this "glitch" occur only when the section is added, but when the header is off screen and then re enter the screen scrolling back the correct Y position, the cell is visible again; many people have this problem, is possible to track it someway?

from eureka.

mlorenze avatar mlorenze commented on June 3, 2024

Describe the bug I wish to re-use a custom class with a xib file in a section with some rows added dynamically, but when I use the following code

var section = Section() { section in
      section.tag = v
      var header = HeaderFooterView<EKHeaderClass>(.nibFile(name: "EKHeader", bundle: nil))
      header.height = { 25 }
      header.onSetupView = { view, _ in
        view.titleLabel.text = "My title"
        view.subTitleLabel.isHidden = "My subtitle"
      }
     section.header = header
}

section.insert(contentsOf: [rowA, rowB], at: 0)
form.insert(section, at: mealParts.count)

I see that the xib view and its class gets instantiated but it disappear immediately; if I keep adding more of the same to have a very long table/form and i start to scroll, the headers reappear without problems. On the contrary, if I use a simple view class, I have no problems and I see the header being attach and never disappear. Does anyone knows how to fix this?

Thanks 1k

Versions (please complete the following information):

  • Device: iPhone 12
  • OS: 15.0
  • Eureka Version 5.4.0
  • Xcode version 14.1

How is the behavior in this assignment (inside the onSetupView block):
view.subTitleLabel.isHidden = "My subtitle"

from eureka.

mlorenze avatar mlorenze commented on June 3, 2024

I created this ViewController, with the custom header subclassing UITableViewCell. I could not reproduced the issue.

import UIKit
import Eureka

class ViewController: FormViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        for _ in 0...19 {
            createSection()
        }
    }
    
    private func createSection() {
        var section =  Section() { section in
                var header = HeaderFooterView<EKHeaderClass>(.nibFile(name: "EKHeader", bundle: nil))
                header.height = { 25 }
                header.onSetupView = { view, _ in
                    view.titleLabel.text = "My title"
                }
                section.header = header
            }
        
        let rowA = LabelRow() {
            $0.title = "Row A!!!"
        }
        
        let rowB = LabelRow() {
            $0.title = "Row B!!!"
        }
        
        section.insert(contentsOf: [rowA, rowB], at: 0)
        form.insert(section, at: 0)
    }
}

class EKHeaderClass: UITableViewCell {

    @IBOutlet var titleLabel: UILabel!

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
}

Versions:

Device: iPhone 14 Pro
iOS: 16.1 (20B72)
Eureka Version 5.4.0
Xcode version 14.1 (14B47b)

from eureka.

DigitalVanilla avatar DigitalVanilla commented on June 3, 2024

How is the behavior in this assignment (inside the onSetupView block): view.subTitleLabel.isHidden = "My subtitle"
I have a stackview vertical and when there is only the title I hide the subtitle

from eureka.

DigitalVanilla avatar DigitalVanilla commented on June 3, 2024

Ok, so is possible to use a custom tableviewcell instead of a view, good to know.

from eureka.

DigitalVanilla avatar DigitalVanilla commented on June 3, 2024

Ok, I was testing it and I found out that if I delay the creation of the sections with the custom header form a nib, it does not works.
Please add this to your code:


DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) {
      for _ in 0...19 {
        self.createSection()
      }
    }

from eureka.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.