ios - Why do the child widgets of my custom UITableViewCell stack on top of each other? -
i have custom uitableviewcell i've designed in storyboard. custom cell contains label , text field. label should on left side of cell , text field should on right side. no matter combination of constraints try (constraining right side of text field right side of cell, spacing left side of text field 300 pixels label, etc...) text field ends stacked on label when run app.
here's screenshot of portion of storyboard
in image, trailing edge of text field set trailing margin of parent.
this looks in app.
this code custom table cell class:
class itemrowcell: uitableviewcell { @iboutlet weak var itemdescription: uilabel! @iboutlet weak var quantity: uitextfield! override func awakefromnib() { super.awakefromnib() // initialization code } override func setselected(_ selected: bool, animated: bool) { super.setselected(selected, animated: animated) // configure view selected state } }
you've set incorrectly... suggest, start fresh.
delete current label , text field.
add new label cell prototype, , set leading constraint 0 , vertical constraint centered - should this:
add new text field, , set trailing constraint 0, vertical constraint centered, , width constraint 80:
re-connect @iboutlets, , run app.




Comments
Post a Comment