Constraints Problems with table view cell - ios

I have problems with constraints in table view cell. As you can see in the image above , I tried to constrain the label on the far right so that label will be closer to the right right edge. But that isn't reflecting on the ipad in preview. Whats wrong? and How do solve this problem ? Thanks for any help !

The prototype cell in the storyboard is just that: a prototype. It isn't "real". It will be used as a cell when the app runs, and layout will occur. But the Preview in the storyboard in Xcode (in your version of Xcode) doesn't reflect any of that.
So the only way to see the effect of your constraints is to build and run the app in an appropriate Simulator.

Related

xCode7 StackViews inside ScrollView overlapping views

this is my first job with xCode and I'm migrating an Android App to IOs. I'm attempting to create a ScrollView with some items inside of its content view. Below is a print of the Storyboard tree:
When I run the app, the items below the selected StackView, including it, do not appear correcly on the simulator. They are all overlapped at the top of the screen:
I have already double checked all the constraints, along with other properties on the views but could not find the issue. Any help will be very appreciated.
Thanks!
=========================================
Thanks, Imran. This helped me find the issue. But I still would like to understand it. As you can see from the picture below, some of the views in my storyboard have this "wAny hR" property set. Literally all the stackviews and, the Labels and Buttons which were messy. Once I remove this property and set the "Installed" one, they showed up ok. Any thoughts on that?

Auto-layout features not working in a table view cell in xcode?

I am making a simple app since I'm quite new to xCode. I have a table view which holds cells. I've added constraints that I was hoping would dynamically change the width of the cell depending on the device (iphone vs iPad). However, it doesn't seem to be working.
I believe I've set all the necessary constraints, but I guess I must be missing some.
Here is an image of what I'm working with:
And this is the problem, when I change the size of the device I'm working on, the labels in the cell don't resize themselves.
Here are the constraints I'm currently using:
Any help would be appreciated, thanks.
Most probably you haven't updated the frames after changing the size of the view controller

IOS UITableView right half cut off screen

For some reason, no matter what I do, when I create a static tableview inside a UITableViewController, put content into the cells and run the simulator the right half of the screen is always cut off and I don't know why. Ive tried making new projects and remaking the storyboard but nothings working.
Here's what it looks like when I run the app
heres what the storyboard looks like.
I have content set to static cells
Anyone run into this problem or know how to fix it via storyboard (or programmatically but not preferred)?
Update:
Here are some more pictures of what another project looks like when I run it:
and here's what the storyboard looks like
You need to give constraints to your right button...
For that select your button and pin its edges to right, top, bottom and give width constraint like below
and here is autolayout tutorial link .. you can check that
I see the problem in giving constraints to the table not for the button.
Try giving constraints to the table like "leading space to superview,trailing space to superview,top space and bottom space to superview
Edit:
The above solution given by me might fix for tableview inside UIViewcontroller.

TableView and CollectionView position & size automatically gets change in Storyboard in iOS

I have searched alot but found nothing on this issue.... :(
I have added a CollectionView and two TableView in a storyboard.
Every thing was working perfectly fine.
Now the Problem is both TableViews and CollectionView is automatically gets change their position & size and moved in storyboard's left upper corner.
Almost hide themselves.
When i drag them one by one and change layout / position, they again change their position and size when i select any other object(Button/Label) on storyboard.
Here is the Screen shoot i just take of my storyboard.
I have removed / deleted the storyboard and congifure it again from start but the problem is same :(
what is this all happening.... I don't know what to do here?
Please help me on this issue.
CollectionView is just behing that misplaced TableView in storyboard's left upper corner.
Haven't worked much with XCode version 6, but this issue maybe arising due to AutoLayout or the new view size properties introduced in Xcode 6 & above. Try disabling AutoLayout.

UIDatePicker alignment inside static UITableView doesn't line up in storyboard vs simulator

I'm trying to learn how to embed pickers into table views and am starting off nice and simply with a static tableview where I've inserted a UIDatePicker within it.
Unfortunately I'm seeing odd behaviour with how the UIDatePicker aligns within the cell. If I line everything up nice and centred within the storyboard then when i run in the simulator i find the picker displays lower than centred and so looks messy. In the end by eye I've had to add padding to the cell beneath the picker in the storyboard to get it looking reasonable within the simulator when running. As shown in the following images.
Anyone any ideas why the storyboard layout isn't being honoured, or whether there's something I can change which would make them behave themselves better?
Apologies for the image resolution size.
layout of picker and cell in the storyboard
outline of my tableview in the storyboard
picker and cell shown in the simulator
Ok I eventually fixed this... i tried using some auto constraints having snapped the picker to the centre of the cell, sadly this didn't seem to help.
I then cleared the constraints and used the align button to add constraints for horizontal and vertical center in container. Added these constraints and now the picker is behaving consistently between the storyboard and the simulator.
Not sure why when adding it centred using the blue guidelines it didn't default to this sort of behaviour without the constraints but now I know.
Thanks to anyone who took the time to read my question.

Resources