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

enter image description here

in image, trailing edge of text field set trailing margin of parent.

this looks in app.

enter image description here

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:

enter image description here

add new text field, , set trailing constraint 0, vertical constraint centered, , width constraint 80:

enter image description here

re-connect @iboutlets, , run app.


Comments

Popular posts from this blog

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

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

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