ios - Why does my UITableView's formatting go completely awry when I return from a view controller I segued to? -
ios - Why does my UITableView's formatting go completely awry when I return from a view controller I segued to? -
i have uitableview
custom cell, has few labels in dynamically decide height of cell. when tap on 1 cell , segue new view controller, upon returning formatting cells messed up, , can't figure out causing it.
here cells like:
and have pretty basic constraints set on them. top label pinned top , left margins, , must >= 20 right. other labels aligned left of first label, vertical spacing set between of them. middle label has right spacing constraint margin, , bottom labels aligned baseline of first , have horizontal spacing between of them.
when segue table view looks however:
i can't figure out causing layout differently when left. if scroll around seems "reset" them should be, on initial load they're messed up. can attach project if desired, there's not much outside of storyboard.
cellforrowatindexpath:
override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { allow cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) customtableviewcell allow object = objects[indexpath.row] cell.title1.text = object.name cell.title2.text = object.color cell.title3.text = object.roar homecoming cell }
sample project: http://cl.ly/040l2z0q0v2d
it appears table view cells aren't resizing based on contents when returning segue. using sample project, threw reload info in viewwillappear , seemed prepare issue.
override func viewwillappear(animated: bool) { super.viewwillappear(animated) self.tableview.reloaddata() }
ios objective-c uitableview uiviewcontroller autolayout
Comments
Post a Comment