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

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -