Swift tableView.reloadData()是否不调用heightForHeaderInSection?
我有一个表格视图,在各个部分中标题的高度不同。当方向改变时,我想更新标题的高度 但是我注意到调用Swift tableView.reloadData()是否不调用heightForHeaderInSection?,swift,uitableview,height,xcode7,uiinterfaceorientation,Swift,Uitableview,Height,Xcode7,Uiinterfaceorientation,我有一个表格视图,在各个部分中标题的高度不同。当方向改变时,我想更新标题的高度 但是我注意到调用tableView.reloadData()不会影响heightForHeaderInSection方法 如何在方向更改时更改收割台高度 附言 已设置代理。 头部高度部分: override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { if(sect
tableView.reloadData()
不会影响heightForHeaderInSection方法
如何在方向更改时更改收割台高度
附言
已设置代理。
头部高度部分:
override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if(section == 1) { return screenHeight - 300 }
else { return 0 }
}
override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {
if(toInterfaceOrientation.isLandscape)
{
if(wasInPortrait){ screenHeight = bounds.width }
else { screenHeight = bounds.height }
}
else
{
if(wasInPortrait){ screenHeight = bounds.height }
else { screenHeight = bounds.width }
}
self.tableView!.reloadData()
}
let bounds = UIScreen.mainScreen().bounds
var screenHeight: CGFloat!
var wasInPortrait = true
override func viewDidLoad()
{
super.viewDidLoad()
screenHeight = bounds.height
if UIApplication.sharedApplication().statusBarOrientation.isLandscape { wasInPortrait = false }
dispatch_async(dispatch_get_main_queue()) { self.rateMe() }
}
将旋转接口方向:
override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if(section == 1) { return screenHeight - 300 }
else { return 0 }
}
override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {
if(toInterfaceOrientation.isLandscape)
{
if(wasInPortrait){ screenHeight = bounds.width }
else { screenHeight = bounds.height }
}
else
{
if(wasInPortrait){ screenHeight = bounds.height }
else { screenHeight = bounds.width }
}
self.tableView!.reloadData()
}
let bounds = UIScreen.mainScreen().bounds
var screenHeight: CGFloat!
var wasInPortrait = true
override func viewDidLoad()
{
super.viewDidLoad()
screenHeight = bounds.height
if UIApplication.sharedApplication().statusBarOrientation.isLandscape { wasInPortrait = false }
dispatch_async(dispatch_get_main_queue()) { self.rateMe() }
}
ViewDidLoad:
override func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if(section == 1) { return screenHeight - 300 }
else { return 0 }
}
override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {
if(toInterfaceOrientation.isLandscape)
{
if(wasInPortrait){ screenHeight = bounds.width }
else { screenHeight = bounds.height }
}
else
{
if(wasInPortrait){ screenHeight = bounds.height }
else { screenHeight = bounds.width }
}
self.tableView!.reloadData()
}
let bounds = UIScreen.mainScreen().bounds
var screenHeight: CGFloat!
var wasInPortrait = true
override func viewDidLoad()
{
super.viewDidLoad()
screenHeight = bounds.height
if UIApplication.sharedApplication().statusBarOrientation.isLandscape { wasInPortrait = false }
dispatch_async(dispatch_get_main_queue()) { self.rateMe() }
}
您没有根据方向更改页眉高度,您是根据章节号更改页眉高度我需要特别的第1节根据方向更改页眉高度?感谢更新您的问题,现在更有意义您没有根据方向更改页眉高度,您正在根据节号更改它我需要特别的第1节更改方向更改时的高度?谢谢更新您的问题,现在更有意义了