Sono in procinto di aggiornare la mia app a iOS10 con Swift 2.3 e Xcode 8 Beta 1 e ho trovato che c'è un UITableViewHeaderFooterContentView
che sta bloccando i tocchi a UIButton sul mio sottoclasse di UITableViewHeaderFooterView
.iOS10 - Tentativi di blocco ContentView di UIButton in UITableView Header
Sul simulatore Xcode 8 Beta 1 UIButton funziona su iOS9.3 ma non su iOS10.
1) C'è qualche documentazione per questo?
2) Come posso garantire che i miei elementi dell'interfaccia utente siano in cima alla nuova vista contenuto in iOS10? (o consenti i tocchi attraverso lo UITableHeaderFooterContentView
)
Grazie!
Tabella intestazione
import UIKit
class TableHeader: UITableViewHeaderFooterView {
@IBOutlet weak var dayLabel: UILabel!
@IBOutlet weak var dateLabel: UILabel!
@IBOutlet weak var addNewEventButton: UIButton!
}
codice In View Controller dateCell.addNewEventButton
è l'UIButton che non sta ricevendo tocchi in iOS10
func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let tintColor = TintManager().getTintColour()
let dateCell:TableHeader = tableView.dequeueReusableHeaderFooterViewWithIdentifier("TableHeader") as! TableHeader
//dateCell.bringSubviewToFront(dateCell.addNewEventButton)
dateCell.dayLabel.text = Dates.day.uppercaseString
dateCell.dateLabel.text = Dates.date
dateCell.backgroundView = UIView(frame: dateCell.frame)
dateCell.backgroundView!.backgroundColor = tintColor
dateCell.dayLabel.textColor = UIColor.whiteColor()
dateCell.dateLabel.textColor = UIColor.whiteColor()
dateCell.addNewEventButton.backgroundColor = tintColor
dateCell.addNewEventButton.tag = section
dateCell.addNewEventButton.layer.cornerRadius = 20.0
if (savedEventView.superview === self.view) {
dateCell.addNewEventButton.removeTarget(nil, action: nil, forControlEvents: .AllEvents)
dateCell.addNewEventButton.addTarget(self, action: #selector(ViewController.userPressedAddButtonToInsertSavedEvent(_:)), forControlEvents:.TouchUpInside)
} else {
dateCell.addNewEventButton.removeTarget(nil, action: nil, forControlEvents: .AllEvents)
dateCell.addNewEventButton.addTarget(self, action: #selector(ViewController.userPressedAddNewEventOnTableViewHeader(_:)), forControlEvents:.TouchUpInside)
}
return dateCell
}
prega di passare attraverso il documento di migrazione .I pensare SWIFT 3.0 introdurre in Xcode 8 Beta 1 – Tuple
E 'la mia comprensione che Swift 2.3 è ancora compatibile in Xcode 8 Beta 1 –
Sì, naturalmente, la vostra comprensione è giusto – Tuple