First of all, you should move the code associated with the TableView from tableView:cellForRowAtIndexPath , preferably before viewDidLoad :
override func viewDidLoad { super.viewDidLoad() tableView.separatorColor = UIColor.clearColor() tableView.tableFooterView = UIView() }
Secondly, UITableViewCells are reusable objects, therefore, if necessary, they are unloaded by a table view:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { var cell = tableView.dequeueReusableCellWithIdentifier("Cell") if cell == nil { cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "Cell") } ... }
As for your problem, you should either set rowHeight to tableView
override func viewDidLoad { super.viewDidLoad() ... tableView.rowHeight = 100.0 }
or implement tableView:heightForRowAtIndexPath: instead:
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat { return 100.0 }
You should also update the value of the textLabel frame and the corner radius instead of the cell:
ozgur source share