swift3 - Create a label programmatically for a cell in Master-Detail App - Swift 3 -


can point me right direction on how create label programmatically inside of cell master-detail application in swift3? have specified 2 labels (itemid, itemname) in storyboard. however, know how create labels programmatically. tried create label itemdescription programmatically on own didn't work. sure code quite wrong. appreciated!

override func tableview(_ tableview: uitableview, cellforrowat indexpath: indexpath) -> uitableviewcell {         let cell = tableview.dequeuereusablecell(withidentifier: "customcell", for: indexpath) as! customcell          let item = itemsarray[indexpath.row]          cell.itemid.text = item.itemid         cell.itemname.text = item.itemname           let itemdescription: uilabel = {             let label =  uilabel()             label.text = item.itemdescription             return label         }()          func setupviews() {             self.view.addsubview(itemdescription)         }      return cell     } 


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -