Weitere ähnliche Inhalte
Ähnlich wie Extra view @ kyobashi.swift (20)
Kürzlich hochgeladen (11)
Extra view @ kyobashi.swift
- 6. “Add and edit views
outside of the main view
controller by adding them
to the scene dock.”
- 13. コードで書いてたり
func tableView(tableView: UITableView, viewForHeaderInSection
section: Int) -> UIView?
{
let label = UILabel(frame: CGRect(x:0, y:0, width:
tableView.bounds.width, height: 50))
label.textAlignment = NSTextAlignment.Center
label.font = UIFont.italicSystemFontOfSize(21)
label.backgroundColor = UIColor.redColor()
label.textColor = UIColor.whiteColor()
label.text = "タイトル
return label
}
- 15. xib使ってたり
// headerの登録
let nib = UINib(nibName: “CustomHeaderView”,bundle:nil)
self.tableView.registerNib(nib: nib,
forHeaderFooterViewReuseIdentifier: "CustomHeaderView")
// headerのdequeue
tableView.dequeueReusableHeaderFooterViewWithIdentifier("CustomHeade
rView")
- 22. 注意 : Copyで渡さないと・・・
// MARK: - UITableViewDelegate
extension TimelineViewController:UITableViewDelegate {
func tableView(tableView: UITableView, viewForFooterInSection
section: Int) -> UIView? {
let copiedFooter =
NSKeyedUnarchiver.unarchiveObjectWithData(NSKeyedArchiver.archivedDat
aWithRootObject(self.sectionFooterView)) as!
TimelineSectionFooterView
return copiedFooter
}
func tableView(tableView: UITableView, heightForFooterInSection
section: Int) -> CGFloat {
return self.sectionFooterView.frame.size.height
}
}