autoresizingMask not responding properly - iphone

I've implemented autoresizing mask in all my the views of my project very successfully. However in the last one, which is the settings and there are a lot of sliders inside tableCells, it seems it doesn't work too well.:
I'm sure I've implemented the thing right
slide.autoresizingMask=UIViewAutoresingFlexibleWidth
for the sliders and flexible left margin for the labels.
I've also implemented table reload when the rotation takes place.
The cells are being reused ok, or at least in portrait mode they work, but when I rotate and go back I got what you see in the picture.
Any ideas on what am I missing?
Thansk in advance!

Related

Constrain to margin isn't working properly on Xcode

I'm trying to set a constrain of "0" to a UIImageView from the sides (left & right) but when I add the constrain with "Constrain to margin" checked, it pins the image all the way to the edge of the ViewController while it should keep some distance, why is this happening?
I was having the same problem and recently resolved the issue by turning off the safe area. Safe Area Layout is enabled by default. To disable Safe Area Layout in Xcode 9, choose View > Utilities > Show File Inspector and deselect the checkbox for Use Safe Area Layout Guides. This should correct the issue. Good luck, hope it helps.
Check to see if your UIImageView is overlapping or placed past that margin line. If this is the case, the constrain to margin thing doesn't do anything. What I did to fix this was manually move that object so that it was away from the margin line and try again.
This lets you keep the Safe Area.
I found that if the UIView is overlapped with or by another view this issue also happens - for example if you want to put an image up by the side and you also have a full screen camera preview.
The solution for me was to drag the view where I wanted it (i.e. to one side) and then set the constraints and it behaved properly from then on - I did not have to remove the safe view. This is with Xcode 10.1.

Xcode constraints and uiimageview as a background

I am sorry if I am going off topic, this is not a question about code, but I am having troubles with constraints
In my app I use a UIImageView as background, I set the constraint for the image to fit the screen and it works
But after that i have a lot of labels and buttons,and if i add even one constraint to one of these elements,it disappears or goes out of the UIImage
I want to set the UIImageView as background,so all the other elements can be placed on the image using constraints ,how do i do it?
To simplify the process can i group all of my interface elements in some views and then apply the constraints to the view?
I need a good explanation and/or tutorial about this elements, at the moment my interface on iPhone 4 fits ok until the iAd shows up, and on the other iPhones there is a lot of empty space
take a look at this tutorial. Hopefully, it will works.
http://www.raywenderlich.com/83276/beginning-adaptive-layout-tutorial
Try this: with one of you elements, cmd+click (or right-click) on it and drag upward until the background UIImage is highlighted. Release and select 'left'. This sets a pinning constraint to the left side of the background image.
Then cmd+click and drag to the side, and select 'top'. This should pin your element to an intelligible spot; it may still need some sizing help, but at least you will be able to guess where it will show up.

Constraints issue in Xcode

I'm having some issues with the constraints in my app. Here is how it looks on the iPhone 4 (that's how i want it to look, and how i usually setup my interface, is this the proper approach or not?)
Now, when i switch to the iPhone 5 screen it looks like this
and as you can see, the blue dots (which is UIButtons) are not placed where i want them to be. I made my constraints rely solely on the right side of the view (since that is the one re-sizing, i found that in order for you'r views to align themselves accordingly, it doesn't help to align them to the left side). I don't really know how to fix this. I am finding this new iPhone screen to be a real pain in the arse. Any good advice on how to work with this new screen without a lot of headache would be appreciated :)
Thanks on advance
It looks to me like the are still the same distance from the right side of your view, as you said you set them to be, while the background has stretched to fit the new size. I suspect it's actually the background that isn't doing what you want it to do (keep the same aspect ratio and show more stuff on the left), or try keeping the buttons relating to left and right to stay aligned with the stretched background image.

TVanimationsGestures Sample code Bug/Weird Behavior Overlapping Cells

Im trying to implement a nice accordion effect on my app. My goal is to "open up" a cell when the user tap on it, diplaying additionnal content (such as text) as the cell height increase.
The perfect sample code for that is the TableView Animations & Gestures sample code provided by Apple. However I am experiencing a strange behavior, that ruins the whole effect.
It appears that depending on the order in which the tableview will display its cells (top --> Bottom or Bottom-->up) the cells textviews will overlap each other or not.
As its a bit difficult to explain with word so here is it with images.
Those screenshots were taken from the TVAnimationsGestures Sample Code, without any changes made to it. It comes from the first version of the sample code without storyboard:
Now the version with the storyboard, first behaved well, but after a while, and without me touching the code it started drawing this :
And I have the exact problem on my custom with my custom cells.
It took me a while to understand what I think the problem comes from. If cells are drawn from the Top cell to the bottom, there is no such problem. However if cells are drawn bottom to the top, they will stack in reverse and therefore overlap each other. I don't think it is possible to control this behavior.
What gave me the hint, is that when I scroll down, forcing the top cell to redraw, they actually redraw nicely, and the screen looks like this:
A Mixture of overlapping cells and "good" cells.
Again, this all comes directly from Apple sample code, without any changes.
Does anyone knows whats going on?
Thanks a lot for your help.
You can increase the cell height by pinching on the cell.

iPhone: No events after rotation

for rotation of my app I use the same view and just rearrange some controls resp. define the appropriate autosize attributes. So, for example, I have a segmented control which goes from the left to the right over the complete screen. When rotating it resizes correct, but I get no events from the segments on the right side (I guess, segements which are located right of the original portrait width).
Does anyone know, why this happens? Thanks for your help.
Regards
Matthias
Found an answer by myself, even though I do not really understand it. Problem was, that I used for the view these "Simulated User Interface Elements". When using those the resize was not done properly. Without them it works perfect.