iOS Universal App Layout Issue - ios

Please see the attached screenshots of the app running - as you can see there is an area at the bottom of the iPhone screen that is not used. The same area of the iPad detail is however. I know there must a bar somewhere I need to hide but I can't find anything amiss.
I have a UITabBar controller as my root VC, which has a tab that leads to the UISplitViewController. As far as I am aware, the UISplitViewController is being used in the standard form.
Can anybody point me in the right direction. I am not sure what information to post, so please ask if you need more info.

Thank you all for your help. In the end though, the solution was fairly simple! I checked the Extend Edges Under Top Bars and Under Bottom Bars options for the UISplitViewController and voila!]1

simple solution
open storyboard
select ur viewcontroller
change wAny hAny
preview ur viewcontroller in iPad/iPhone and all devices u needed
and rotate ur preview screen.

your How to solve this?
Review Debugging Tricks and Tips section of the Auto Layout Guide
Compare storyboard with actual results - does your storyboard contain the same issue (most lightly not).
Review the constraints you have set for the view in question.
Check your constraints for the size classes in view controller with the view in question.
Add an IBOutlet and instance variable for the bottom constraint of the view in question and set breakpoints. Implement any/all of the methods in the UIContentContainer protocol to see what is happening with the constraint and the current class size.
6.Implement - viewWillLayoutSubviews to see any frame changes.

Related

Safe areas on iPhone X wrong

I have a pretty complex app, that causes the safe areas on an iPhone X to be wrong (pushed down).
This screenshot is from a storyboard. It's a container view aligned to the bottom anchor of the Safe Area Layout Guide.
Everything looks fine there and produces the correct result in an empty, new project.
But as soon as I instantiate and push the view controller in the original app, the result is this:
What could cause the safe areas to be distorted?
The property additionalSafeAreaInsets is definitely not set anywhere in the app. I've played around with a couple of other UIViewController properties, but nothing seems to change this.
Thanks!
Please share constraint layout view for your button to get proper/exact solution to your problem.
Here I had same problem.
I had added another view as a subview (gray view) in a main view and moved my button in it. I enabled the safe area layout guide for both main view and gray view.
Safe area layout for gray view safes my button inside safe area.
iPhone X, Layout Preview:
Hope this may help you!
Click on the View(which contains your button) and then check Safe Area Layout Guide
So to perfectly answer my original question:
What could cause the safe areas to be distorted?
Turns out a totally different part of the app was modifying the size of the parent view controller's view.

iOS8 Size-Classes and Popover Views

I had an issue with Popover on an iPad app I was working on recently...going to just post it here as I think it may help others.
I'm using Xcode 6 and iOS 8 and Size Classes and the Popover View was built in a Storyboard.
As my iPad App is in Regular/Regular Size Class all the time I built the Popover view in R/R too.
No matter what I did with Constraints though, the popover just never looked right, it was a mess. So what was wrong??
After some time the penny dropped to check the Any/Any Size class constraints.... These were matching the erronous constraints that I was spitting out in the logs. So I designed the Popover view in the A/A size class and it worked fine!
This might seem obvious to some but I thought that because my App was R/R that my Popover constraints should be in R/R. However it looks like that if you are using a VC as a Popover that the constraints need to be made in the A/A Size Class.
For me, setting size to Any-Any then re-setting to Regular-Regualr fixed it.

IOS Tableview support all screens and Landscape screen

I Was create a UIViewControler in storyboard or XIB with autolayout.
When i add UITableView into the view controller it does not support all screens properly even not support to portrait/landscape screens too.
I Have attached a screen of my story board.
I am a Beginner for iOS , so i dont know hoe to set constraints.
Please Some one suggest a best tutorial to done this or provide a simple sample application.
FYI: I am using Xcode 6.1 and Objective-C
Thank you!
It sounds like you're having trouble with adding constraints to a UIViewController.
Here is a good primer on AutoLayout on Ray Wenderlich's site. It's a good way to get your feet wet with AutoLayout in Interface Builder.
Once you do that, consider reading this article about why to not use Interface Builder. I was finally convinced by this article to go the pure-code route, and I've enjoyed the results.
Anyway, for your particular example, here are some screen shots to add the constraints to your UITableView:
When you add the UITableView to your UIViewController, you probably lined it up so that all edges between it and its containing view matched up. In that case, when you click the "TIE Fighter" button (really called the "Pin" button), you should see the following:
At this point, you simply need to click the 4 "struts" to add those constraints to your UITableView. When you do that, they'll turn from light gray to red, as seen here:
At that point, simply click the "Add 4 Constraints" button to finish the job. Your UITableView should now be "pinned" to all 4 edges, causing it to resize automatically during rotation.

UIViewController completely out of place on the screen

I am putting together a sample iPhone app for practice. It is a drill-down interface with doctors who have patients who have prescriptions and visits using Core Data and a story board.
Everything was going great until I started on the Edit/View doctor screen. Because this screen is triggered by a button in the UITableViewCell, it seemed that there was no way to create a segue on the story board to an edit/view screen because the buttons in the cells are dynamically created.
I decided to make a separate UIViewController custom class and I let Xcode generate the XIB for me to make sure I did not mess up anything. I presented the edit/view view controller by pushing onto the navigation controller. The problem is that the contents of the edit/view screen were nearly completely off the screen. With my first attempt, a navigation bar I put at the top appeared at the very bottom of the screen in the simulator with all of the rest of the text fields and labels not showing at all.
I then created another view controller with xib, specifying iPhone only and simply put a label with "Hello" in the center of the view. When I ran the simulator, "Hello" was centered vertically, but was all the way to the right of the screen with only "He" showing. I tried played with anything I could find to play with, but nothing fixes it. I am not trying to do anything unusual. I want to do everything in the usual accepted way.
Also, it seems like Interface Builder makes the views look like big square iPad screens even when I have specified iPhone. I did check the frame dimensions and it was wxh = 600x600.
Thank you for your help.
It occurred to me to search for 600x600 and it seems that this is the new UIView that Interface Builder provides by default. Because there are many screen sizes, Constraints are apparently mandatory now.
My edit/view form was completely fixed by viewing the XIB and going to:
Editor->Resolve Auto Layout Issues->Add Missing Constraints.

iOS UI elements are stretched after switching back and forth in tab bar controller

I have several UI elements on an iOS app first view in a three view tab bar controller.
When I run the app, the first view looks a certain way but then I switch to another view and then back to the first one - the first one is stretched (mainly seems to be doing so vertically).
I presume it has something to do with constraints but I'm not sure.
What might be causing this issue?
Thanks!
When you see things change on you randomly that typically means you have an ambiguous layout. Which means you did not give enough information to auto layout to know exactly what you want. For example did you setup your horizontal constraints?
You can check this by setting a break point and running this in the debugger
po [[UIWindow keyWindow] _autolayoutTrace]
Also if you post your constraints someone may be able to help you out better.
This is due to a bug in iOS where the bottomLayoutGuide is wrongly set to 0.
UIViews ending up beneath tab bar

Resources