我有一个UITableViewController,其样式为uitableviewcellstylesubtitle,其中字幕标签的numberoflines = 0
如果我这样做
tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 44.0
Run Code Online (Sandbox Code Playgroud)
细胞不做自动高度,它真的是真的 - 你不能在默认的样式细胞上使用它吗?
编辑:
人口简单
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
let thisHelpArticle = helpObjects[indexPath.section]
cell.textLabel!.text = thisHelpArticle.helpHeadline
cell.detailTextLabel!.text = thisHelpArticle.helpDescription
return cell
}
Run Code Online (Sandbox Code Playgroud) 所以我正在制作一个基本的周选择器,您可以在其中选择周数和年份,并从周开始点获取相应的日期。
一个基本的测试场景
let calendar = NSCalendar.currentCalendar()
let components = NSDateComponents()
components.year = 2015
components.weekOfYear = 15
print(calendar.dateFromComponents(components)!)
Run Code Online (Sandbox Code Playgroud)
你可以看到,我将通缉年份设置为 2015 年,通缉周设置为 15,但我得到的结果是:“2014-12-31 23:00:00 +0000”
......这真的让我挂了。无论我选择哪一周和哪一年,它总是会在 12 月关闭。
预先感谢您的帮助。