Avevo uno strano problema nell'eseguire l'intestazione di UICollectionView
.UICollectionReusableView - Ritorno mancante in una funzione
ho praticamente usato il codice: http://www.raywenderlich.com/78551/beginning-ios-collection-views-swift-part-2
func collectionView(collectionView: UICollectionView,
viewForSupplementaryElementOfKind kind: String,
atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd.MM.yyyy' - 'HH:mm'"
//1
switch kind {
//2
case UICollectionElementKindSectionHeader:
//3
let h =
collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "eventHeaderView", forIndexPath: indexPath) as eventHeader
h.eventFirstline.text = "First Line"
h.eventSecondline.text = thisEvent.eventName
h.eventDate.text = dateFormatter.stringFromDate(thisEvent.startDate)
h.eventDescription.text = thisEvent.shortDescription
return h
default:
//4
assert(false, "Unexpected element kind")
}
}
Tutto ciò che funziona perfettamente bene quando istantaneamente la distribuzione sia al simulatore o su un dispositivo vero e proprio, ma stranamente quando voglio costruire un Ad-Hoc Pacchetto per i test scopi mi dice
Manca ritorno in una funzione dovrebbe tornare 'UICollectionReusableView'
Ok fin qui tutto bene, non c'è nulla al di fuori del caso switch in modo che non possa restituire nulla - ma perché non fornisce alcun avvertimento su "hot deploy" solo quando provo a creare un pacchetto?
grazie per l'intuizione – longbow
Siete ovunque! Grazie per l'ennesima risposta. :) – Crashalot
A BIG THUMBS UP .. –