Skip to content

Instantly share code, notes, and snippets.

@cactis
Last active August 29, 2015 14:28
Show Gist options
  • Save cactis/ef464037a9a39a1afdd7 to your computer and use it in GitHub Desktop.
Save cactis/ef464037a9a39a1afdd7 to your computer and use it in GitHub Desktop.
about dynamic height of custom cell
//
// IssuesTableViewController.swift
// imuc
//
// Created by ctslin on 2015/8/4.
// Copyright (c) 2015年 ctslin. All rights reserved.
//
import UIKit
class TasksViewController: UITableViewController {
var collectionData: [Task] = []
let CellIdentifier = "CELL"
let iconSize = Configure.Size.BarButtonItem.Normal.rawValue
override func viewDidLoad() {
super.viewDidLoad()
enableToggleMenu()
// tableView.estimatedRowHeight = 180.0
// tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension
styleUI()
}
func styleUI() {
println(__FUNCTION__)
tableView.backgroundColor = UIColor.whiteColor()
}
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return 100
}
//
// override func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
// return UITableViewAutomaticDimension
// }
override func viewDidAppear(animated: Bool) {
reloadData()
}
func reloadData(){
}
func openTask(index: Int) {
}
func plusButtonItemTapped() {
println(__FUNCTION__)
UIHelper.presentViewController(IssueFormViewController(), delegate: self) { () -> () in
}
}
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return collectionData.count
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
println(indexPath.row)
var index = indexPath.row
openTask(index)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment