Xcode messed up constraints and auto layout after reloading project - ios

I have a static table (UITableViewController) with few cells , its a data entry form basically, when i created this and put all the constraints all was good until i reloaded the project , now all the components are outside of view and entire layout is messed up along with constraints. This has happened twice and i have no idea why this is happening
I deleted entire project and pulled it from repository , but still its same
important thing is this runs fine inside app, shows the correct screen , so looks like this is some Xcode rendering specific issue,also this it not happening with some other screens in project, I have tried deleting tableviewcontroller and adding it thrice but same result.
This TableViewController is linked to a UIViewController which has collectionview upon taping one of the collectionview cell this view gets laucnhed and hence linked though a show segue.
****** edit ***********
Figured it out , this happens especially when i add height and width constraints to the label and textfield

ok here is how i solved the issue ,
I found out that if i add height constraints on controls inside a TableViewCell then it would mess up the design, thus not adding height constraints and instead managing with top and bottom spacing helped. Still not sure why this is happening to only certain TableViewController and not all.

Related

UI Table Reuse Cell Constraints Looks Fine in IB But Doesn't Work When Simulated

I am having an issue with my table reuse cell where I an unable to style it as some constraints don't seem to apply. In the IB I have applied a constraint to a stack view so it is 40 left from the superview (as seen
here.
Anyway it displays fine in the IB, there are no warnings or anything and in my code I don't change any of the constraints or layout when populating the stack view.It displays fine here.
When I run it in the simulator though it doesn't display right, completely ignoring the left constraint as seen here where the time is directly up against the side.
As I said earlier in my code to populate the table view I simply add text to the labels and change the background colour of the cell. Any help would be greatly appreciated.

Autolayout is ignored in custom TableViewCell

I'm trying to constrain some objects in my tableview cell so that they will be formatted correctly and won't clip on different devices. But, whenever I add a constraint to an object in there, it throws the object off screen to the top left. In the screenshot I attached I showed it with the green bar on the left but the same is true when I do it to the other labels and text fields.
Any ideas as to what I'm doing wrong?
I have a near identical table view that gets its data from another source and have them constrained the same way, but that tableview cell is formatted correctly when I build it.
I am seeing things online about Tableview cell subclasses. Is there something else I am supposed to be implementing in order to get these to stay? I'm not sure why they are working on one of my tableviews but not the other.
I am having the same issue that is being seen here Autolayout is ignored in Custom UITableViewCell but her answer is confusing me and I can't figure out how to reproduce it
This is what it looks like when the app is built:
Figured it out. For anyone else who may have this problem in the future. You need to click on the content view in the Storyboard and go to the indemnity inspector. Then from there make sure the Class is set to the default of UIView and not the custom class of the TableView Cell.

Overlapping section names in UITableView in Swift

I have a container in my UIControlView.
This is the relevant part of Storyboard. The starting view is a TabBarController, that has a TableView (named _Constructed_) in its second tab. The Table is embedded in NavigationController. When user taps at a cell in this Table, he's taken (with a Show segue) to a GameDetailViewController, that has two containers - the upper one is PageView and the bottom one is TableView.
The issue appears in this TableView. Even though I have constraints set up (width is the same superview's, height is from bottom tabBar to the upper Container, which has fixed height and width), both upper and bottom sides are kinda pushed in a way.
I managed to fix this issue by merely restarting XCode and reopening the project a few times. Maybe it's some kind of a bug, I haven't changed my code in any way and it just started working.
I suggest you need to pay attention to the Size Classes you used. When you reopen your Xcode, it directs you back AnyW, AnyH. It might change the fixed size under some scenario. Also, make sure that you are testing using the same simulator.
I had the same problem.
Im not sure, but you can replace the header from the tableView and it would work right.
tableView.tableHeaderView = myPageView
If it's not the case you should manage the contentInset and contentOffset by yourself for your header and for the list.

Interface Builder is not letting me delete a button

To clarify: I have a view/vc which is designed as an orphaned scene in IB in the storyboard it is used within. This view has a button with an image, a height and width constraint, a left and top constraint. There is a table below it with top, left, bottom, right constraints set to 0. A seperate VC loads this view, sets its width to half the screen and animates it coming in and sets its delegate.
All's honky dory. Now, we wanted to edit the sizing of the button and some miscellaneous things. I noticed the constraints seemed to not be getting applied in simulator. I then, after a while of playing with constraints and losing my mind, decided that maybe something more fundamentally wrong was occurring so i decided to delete the button and see where the table below it is getting placed with it's constraints set.
Then, nothing. The button is still there. I have looked to see if I accidentally c/ped it, and I have not. Is this a known bug?
Clean the project and delete the app on simulator.

Why isnt XCode 5 adding constraints in storyboard as I move views around using autolayout

My app was working and was ready for submit yesterday. I stupidly upgraded xcode. Some views needed adjustment. I got all but one working.
The one that isnt working is
View
Scrollview
Other child views
The problem is the scrollview doesnt scroll. User interaction is checked. I even recreated the entire view from scratch and relinked everything to my class.h and segweys.
I noticed that there are no constraints setup for this scrollview, or for any of the child views. When moving views around it no longer creates the purple, system constraints automatically. Before this I had converted the purple constraints to blue constraints and then linked them to the .h file so I could remove them and then apply my own constraints. But now, since there are none being generated I can't convert them to blue to remove. When I add them manually using the pin menu in story board, I get errors when navigating to that view in the simulator because of Prototype constraints generated at run time.
When I click on the view and hit Reset to Suggested constraints it doesnt add any...
How can I make xcode add the purple constraints automatically as I move views around?
I don't think there is a way to automatically add the constraints as you move the view around. If your view doesn't have any constraints, you should choose "Add Missing Constraints", not "Reset To Suggested Constraints"(this should add similar constraints to that you would have gotten automatically in Xcode 4.6). Once you've added the initial constraints, then when you move the view around, you can update the constraints to reflect your new position with "Update Constraints" or command-shift-equals.

Resources