I have created a Splitview and in detailed view I just added a map view there. I did nothing else than including the location and map libraries so the build and run will work.
However, the map shows only partially, do you have any idea why this is happening and how should I fix it?
Thanks a lot!
Here is the project and thanks a lot!
Regards, Yashu!
The autoresizing mask of the map view is not set up correctly. It should have a flexible width and height like its superview.
Related
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.
I am trying to pin a UILabel to the top layout guide but the option does not seems to be enabled.
All my other views on the same controller has such option. Anyone knows what might be the cause?
I got it resolved by shifting the hierarchy down such that it is not the top element under the view on the storyboard scene.
Weird behaviour, anyone knows what the intention behind this?
I am going to make a custom view like this.
Please kindly check this image.
As you can see, I'd like to make a view in the red circle. I am not sure it can be a tableview or not.
There should be several selectable items inside that view. This view should be scrollable by touching event to select an item. When an item is clicked, it should move to the center of the screen. Please note: I need to build it programmatically, not using a storyboard or xib.
That's all.
Please help me out!
Thank you
I think you could try to use the collectionView.Your function could implementation by it.
When you drag a new view into a view controller in the storyboard dotted blue guidelines are supposed to appear, which help to position the view and apply autolayout constraints.
Dotted blue guidelines
In my case these guides do not appear, no matter where I move the view. I must have done something to disable them, but i have no idea what. How can a get the guides back?
I'm using xcode 6.1.1 and autolayout is enabled ( the autolayout checkbox is checked and it seems to be working fine apart from this)
Thanks in advance for any advice you can give.
Make sure Editor > Canvas > Snap to Guides is enabled:
I'm trying to use Auto Layout for a custom Table View Cell in my app.
I can't seem to get the constraints quite right.
I layed the labels out in the custom Table View Cell, but the labels are still getting cut off. Any ideas?
Thanks! Will post anything else needed. Tried to show needed info in picture below:
Debugging in Xcode. Somehow what shows in Simulator looks different than in Xcode debug.
Here's the width of my TableView shown:
UPDATE:
The problem here was related to what user matt said in the accepted answer, but I wanted to make the Q&A a bit clearer now that I have it figured out for anyone else that comes across this.
In his initial comment, he mentioned the Xcode View debugging, which was great and I was able to dig into a little bit more. Its called the Assistant Editor: Device Preview, where you are able to see the layout and layers of what is onscreen to see if maybe you have labels overlapping or going offscreen based on the device it is running on. If you want to check multiple device sized, just hit the plus icon in the lower left hand corner of this picture.
This helped me find overlapping layers and sizing issues with the TableView. I was able to see how it looked on each device size.
What also helps here sometimes to use the Pin menu. Sometimes the labels can run off screen because it doesn't know where the constraints of the cell are based on the device size. So your label can run offscreen if the label is based off of a landscape layout but the device is an iPhone 5 and is in Portrait for example. This is the Pin menu:
Hope that makes sense and gives some more color to the problem. Let me know if you have any questions at all, thanks for the help everyone!
The problem is that you are using auto layout but you have not done anything about sizing the table view. The table view here is not your view controller's view; it is a subview. Your view controller's view is automatically sized to the size of the device / window, but its subviews are not automatically resized. So you are ending up with the table view much too wide for the device; the whole table is sticking off into space on the right side.
Use a trailing space from the right side of your labels to the edge of their superview, and set it to greater than instead of equals with a value of ~ 5
Review the constraints of your tableview with the View. Draw cell border, label border and tableview border with different colors to know which elements do not display correctly.
Ex:
#import <QuartzCore/QuartzCore.h>
...
cell.layer.border.width = 1;
cell.layer.border.color = [UIColor blackColor].CGColor;
The thing that worked for me to solve views being clipped was to uncheck "Constrain to margins" in Auto Layout.