Collectionview in CollectionviewCell

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Collectionview in CollectionviewCell

    Hallo zusammen,
    Ich habe ein Collectionview und in einer der Cells habe ich einen weiteren Collectionview. Alles wird perfekt angezeigt ohne Probleme, bis ich mit NSLayoutconstraint.activate([constraints]) meine subviews in der Cell vom zweiten Collectionview anlegen möchte.
    Meine CollectionViewCell Klasse sieht wie folgt aus:

    Quellcode

    1. class UpcommingTimerCell: UICollectionViewCell {
    2. override init(frame: CGRect) {
    3. super.init(frame: frame)
    4. setupTimerIdLabel()
    5. }
    6. func setupTimerIdLabel(){
    7. self.addSubview(timerIdLabel)
    8. if #available(iOS 11.0, *) {
    9. NSLayoutConstraint.activate([
    10. timerIdLabel.topAnchor.constraint(equalTo: self.safeAreaLayoutGuide.topAnchor),
    11. timerIdLabel.leadingAnchor.constraint(equalTo: self.safeAreaLayoutGuide.leadingAnchor),
    12. timerIdLabel.trailingAnchor.constraint(equalTo: self.safeAreaLayoutGuide.trailingAnchor),
    13. timerIdLabel.heightAnchor.constraint(equalToConstant: 20)
    14. ])
    15. } else {
    16. // Fallback on earlier versions
    17. }
    18. }
    Alles anzeigen
    Sobald ich NSLayoutconstraint aufrufe bekomme ich folgenden Fehler:

    Thread 1: signal SIGABRT
    -[NSISEngine nsli_layoutEngine]: unrecognized selector sent to instance 0x10737e6b0
    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSISEngine nsli_layoutEngine]: unrecognized selector sent to instance 0x10737e6b0'

    Ich hoffe ihr könnt mir helfen und vielen Dank schonmal !
  • Ich hab jetzt einfach mal versucht mein timerIdLabel zum contentView der Cell hinzuzufügen. Die constraints habe ich auch dementsprechend verändert.
    Nun bekomme ich folgenden anderen Fehler sobald NSLayoutConstraint.activate aufgerufen wird:

    Thread 1: EXC_BAD_ACCESS (code=1, address=0x10)

    Hoffe es hilft jemanden und kann mir weiterhelfen.
    Vielen Dank schonmal!