iOS Black bar issue when using auto layout - ios-autolayout

I am using Auto layout in my app. I have added constraints on my view. It is working fine in all iPad simulator and iPhone 4s. But when I run this app on iPhone 5s or greater it is showing black bar on left and right side of the screen.

I have also faced this same issue, when I am converting my iPad app to Universal app.
Ref below Image: You can see Main Interface is not set
After that add LaunchScreen.storyboard to your project if not exists.
Ref this Image: Goto your ProjectName-Info.plist add following key
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
Now run the project

Go to your Storyboard. Click on the UIView. Click on the third icon in the auto-layout stuff on the bottom. Now click all of the red line things in the top (stuff circled in pink in below picture) to be set at zero.
EDIT: another possibility is that you have constrained the size of the view in some way. I would try doing reset to suggested constraints, and then set the constraints illustrated above for the background (grey) view so it fills everything up, but do not set it to have an explicit size.
EDIT 2: If that grey thing in the background is a UIImage, I bet the issue is that it is in Aspect Fit. Change the content mode to Aspect Fill and I think it should work.

Related

Unwanted grey area when simulating iPad Xcode 11/SwiftUI

Question: Can someone identify why I am getting the extra grey area shown in my add item (top screen in screenshot) and how to eliminate it?
I have tried manually setting the size of the background object, removing and re adding constraints, clicking all the Xcode generated solutions for handling the autolayout errors shown below, setting the presentation setting to full size ala this answer all to no avail; it refuses to be consistent with the main menu screen (bottom)
Context:
Running Xcode 11...I have two scenes in a generic barcoding app, the main menu and the add item scene, and I am designing with iPad's in mind. With the size class for ipad pro 9 (wR hR) and set to landscape orientation, my add item scene has a huge amount of gray area bordering the visible content, unlike the main scene (though there is also a little grey area in portrait)
Figured out what was causing my problem; was using the wrong form of segue between screens, per this answer, in my case, a modal segue when I should have just been doing a show segue. Deleting and adding show segues with the presentation set to Full Screen in the destination views Attributes inspector did the trick.

Swift background disproportionate in Storyboard

I have a problem with a background image in a controller .
I set an image directly from a storyboard with ImageView , but this seems to be disproportionate and grainy on the storyboard , but then when you launch the app screen appears proportionate.
That makes me hard to graphic design because I see the storyboard no depreciation corresponding to reality
What can be ?
I hope I was clear enough
thanks
Go on your storyboard, select one of your view controller
Right panel > Size inspector > Select freeform in simulated size
Put the size you want
Note with autolayout you are designing "responsive" interface, that's why the screen is bigger because it's could be an interface which can fit both an iPad screen or Iphone, also a question of landscape/not-landscape.
I don't recommend to change this mode then, or only if you are building an app for a specific screen only.
Also, by default the layout is set to Any Width / Any Height that's correspond to all layouts possible but you can change this in the bottom of the middle panel.

App display does not fill iPad screen

I'm converting an app that I made for iPhone to be used on iPad. Using constraints on the Xcode 6 storyboard is killing me right now.
With my rep score I can't post an image of what I'm getting, but basically even when I set the constraints and the placement of the object (a UIView) on a storyboard sized for iPad, all the objects on the viewController fill only the top/left area of the screen.
What's the best way to handle this?
-- when you change size of view, other view will be auto change to {0,0,0,0}, isn't ?
but it doesn't change in the right panel.
it is your storeboard files some settings have some wrong.
Demo test link http://www.cocoachina.com/bbs/job.php?action=download&aid=80409
Check for those points:
hope this can help you.

Text starting at wrong position in textview in Xcode 6

There's no code involved at the moment, only storyboard or xib files as far as the textview is concerned. This is what I get when running the app on my iPhone 5s or via the simulator.
I'm using auto layout and size classes with the option any width-any height. An imageview at the top, then a label, then the textview.
Here's a picture of the screen. As you can see, it looks as if the text is starting behind the label, but the textview's y is after the label and the constraints seem all correct according to Xcode 6. It works fine on iPad.
Any idea of what I'm doing wrong?
I've found a way round it: textview should have no scrolling enabled and should be put in a scrollview instead, which will do the actual scrolling. Need to add constraints to both.

iPhone 4/iPhone 5 User Interface compatibility in MonoTouch

I am hoping someone can help me out with this one. I have an app that I am trying to update to get rid of the letterbox look when running on iPhone 5. I have added a Default-568h#2x.png to the project and the application seems to scale correctly. The splash screen on either device looks correct, however I have a toolbar on my "Home" screen that I can't seem to get in the right place. If I get it right for 5, I can't see it on 4s, and if I get it right for 4s, it is very low on 5.
Am I missing something? Do I need to manually move the toolbar that is at the top? And will I need to move all the controls around on all of the screens in the app?
Any advice is appreciated!
Thanks
Here are some tips on using Interface Builder to handle resizing.
Take advantage of the Simulated Metrics in Interface Builder, as shown here:
To do so, select your top-level View, and open the Attribute Inspector. Then, you can select different sizes and orientations to see how your view responds.
Select the Autosizing options as shown here:
In your case, you want a fixed margin above, but a flexible margin below. Note that this is the opposite of the default for a toolbar because the iOS convention is for toolbars to be at the bottom of the view.
Realize that resizing due to rotation and different screen sizes can often be handled the same way. (Thus, if you handle portrait and landscape orientations using Autosizing, iPhone5 layout usually takes care of itself.)

Resources