Autolayout with subview screen issue different devices - ios

I have designed simple one page design for universal application. so I had faced issue while checking the 4 inch devices its working fine. other than 5.5 to above devices its not looking good.
View(MAINVIEW)
ScrollView
View
Label
..
..
above I have mentioned the structure of the page.below I have mentioned screen shots.
above Screen shots image I have designed. with all constraints.
after that I have checked the preview of the page design.
Iphone 4-inch its showing fine. but Iphone 5.5 its showing in bottom not filled whole page view.

It looks like then you have set the height constraint for ScrollView or view. If you did this then remove that height constant and set the bottom constraint which should have 0 constant value to its superview.

Related

Constraints to take care of different iPhone/iPad sizes for images xcode 7 beta 4

I'm new to iOS development, so setting constraints for objects on the storyboard in Xcode has been difficult for me.
As this picture below shows, I have 3 borders for buttons I created in sketch so they are all images, each of them inside of a image view:
I tried adding constraints by pinning all three images to the left, right and below themselves but I got errors for it and it did not come out right at all on the simulators. All of the images are in aspect fill mode, and I have the view in the size of an iPhone 4 when I put the images in the storyboard. Here's an example of what it looks like in the iPhone 6 simulator without any constraints:
What are the constraints I need so that it looks okay for all iPhone and iPad sizes and looks like it does in the storyboard? And landscape mode will not be a part of this application, so that will not need to be accounted for.
You can also use button 1 equal width constraint
and button 2 equal width constraint
For more details http://www.raywenderlich.com/83129/beginning-auto-layout-tutorial-swift-part-1
Which is your requirement???

Why do the layout positions change in preview when I simply add a new screen size to the preview screen?

I have a 4 inch screen displayed in Assistant Editor Preview while I'm adding constraints to the view controller in Storyboard. Once I get everything situated in the correct position with the constraints and the layout looks good on the 4 inch screen, I then add another screen size to the preview window. For some reason, just by adding another screen size to the Preview window causes the layout preview on my perfectly good 4 inch screen to slightly be changed. Is this odd behavior or am I doing something wrong?
I had a similar issue, but instead with the 4.7 inch screen size. I found that using 2 things helped me keep the layout and constraints consistent across all screen sizes.
First, keep your storyboard default layout to universal (square) so the constraints aren't applied to one screen size only.
Second, when setting your constraints, use the "Reset to suggested constraints" button located on the third constraints tab.
I have yet to experience layout issues using this method. Hope this helps!

What does define a UIScrollView paging size?

At first, I am facing a strange problem with a UIScrollView with Pagin enable but only on iPhone 4 and iOS 7.
So the idea is that I have a UIScrollView (A) containing a UIView (B) that has subviews (Cs)
It's working perfectly on iPhone 5 screen size, for both iOS 7 and 8.
It's working perfectly on iPhone 4 with iOS 8.
It's not working properly on iPhone 4 iOS 7.x
After hours of logging, here is the problem :
UIScrollView A frame height : 480 <- EDIT : this was sometimes 480, sometimes 568
UIScrollView A content size : 960
UIView B frame height : 960
The first page is displaying properly.
When scrolling down to the second page, UIScrollView A contentOffset is 392, instead of the expected 480, so that there is not way to see the bottom of the second page, and bottom of the first page is still visible at the top of the second page.
So the question is : How does iOS find the page size ?
Any help will be appreciated !
The page size is the size of the scroll view. It sounds like the issue is that the height of the content is not defined correctly. If you are using auto layout you need to make sure that the constraints are set up properly. Otherwise you can set the size of the content programmatically.
Either way checking programatically what the content size of the view is should confirm if this is the issue.
When running in Xcode 6 you can examine the views on the screen more carefully using this button:
found here:
when your code is running and you are on the correct view
I finally get it by removing the UIScrollView bottom constraint and replace it with a height constraint, setting it to the superview height at run time.
It seems that the scroll view paging size is just correctly evaluated, but may scrollview was too big for the screen.

IOS7 Tableview autolayout not work

Oh, I am having trouble with AutoLayout in IB(xcode 5, ios7), an IPad project.
Here is a view hierarchy in my project.
UIViewController->UIView->UITableView->UITableviewCell->UILabel。
And I add some constraints to UILable, (1.pin height, 2. Pin leading space to superview 3.pin trailing space to super view, 6 pin top space to superview.). But when I look in the portrait mode, I think it should change its' width to keep 2 and 3 constraints, but it didn't, can anyone give me a suggestion what should I do.
Thanks a lot!
Here is my screen shot in portrait mode and landscape mode.
I suppose I'm right when I say that you obtain the second screenshot when you select Landscape for the Orientation in the Simulated Metrics of your view controller. As the title of this section suggests, it's a simulation (might be different at run time). The warning message you have might be saying Frame for **** will be different at run time. Have you tried to run your app? Have your labels wrong positions/sizes ?

Problems with layout of 3,5 inch iphone screen

I'm trying to add an iAd banner which I set just above a UITabBar, and it works perfectly on 4 inch screens, but when I test it on 3,5 inch the banner is totally invisible.
Is there a simple way to fix all the views so that everything will be scaled to the 3,5 inch screen if needed?
I've found a tutorial saying to set the "size" of the "Simulated Metrics", under the Attribute Inspector of the view to freeform, but it doesn't work.
You need to specify constraints for how all of the screen contents moves or resizes and the available space changes. The banner view need to be pinned to the bottom and you will need a view somewhere to be pinned to other views but have a flexible height.

Resources