ios - How to programmically add an UILabel to my UICollectionViewCell -


i have custom uicollectionviewcell , has scrollview child. want programically add uilabel scrollview.

class myuicollectionviewcell : uicollectionviewcell {     var newlabel = uilabel?     required init(coder adecoder: nscoder) {         super.init(coder: adecoder)         var labelframe = cgrect(x: 10, y: 439, width: 355, height:0);         newlabel = uilabel(frame: labelframe)          self.scrollview.addsubview(newlabel!)     } } 

i tried doing in init() or init(code adecoder :nscoder) method. exception saying scollview nil. can please tell me best place add uilabel?

thank you.

add label in awakefornib. iboutlets still nil @ time init method called.


Comments

Popular posts from this blog

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -