Questions tagged [safearealayoutguide]

The safeAreaLayoutGuide is a property from UIView class (Apple iOS) representing the portion of the view that is unobscured by bars and other content.

Apple documentation for safeAreaLayoutGuide.

240 questions
0
votes
1 answer

UIview top constrained to safe area, but in viewDidLoad, the view has the wrong Y position

Vertically, my views: Safe Area <- 40 -> Label So in Interface Builder, iPhone 8, the Label has a Y coordinate of 60. Because of the 40 top constraint, but also the safe area has a height of 20 At runtime, I also see the label has the Y coordinate…
A O
  • 5,516
  • 3
  • 33
  • 68
0
votes
1 answer

Get reference of Top constraint

I am trying to get the reference of topConstraint (eg: attached) of a given view, associated with safe area - top. I have created a function which works fine, but, logically not reliable. func getSafeAreaTopConstraint(view: UIView, in targetView:…
iOS
  • 3,526
  • 3
  • 37
  • 82
0
votes
2 answers

iOS - resize view layer to fill iPhone X Max background

I've following https://stackoverflow.com/a/46337372/2139691 in order to have a view to fill the background. So I use a View called myview with a blue background, but when I add a video layer I have bad results. class MovViewController:…
Ricardo
  • 7,921
  • 14
  • 64
  • 111
0
votes
1 answer

Scroll View not scrolling to top

As you can see from the video, when the code is built and ran, the Red View is 0px from the top edge. But after scrolling down and tapping the status bar to return to the top, there is a gap between the top of the screen and Red View (i.e. the black…
0
votes
1 answer

safeAreaLayoutGuide not work for systemLayoutSizeFittingSize

I using safe area in iOS 11 like that: code picture /** mainTableView **/ [self.view addSubview:self.mainTableView]; [self.mainTableView makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.view.left); …
Luk Vbon
  • 1
  • 2
0
votes
1 answer

Set Background Image Including Unsafe Area Programatically (Swift)

Is it possible to have a background image extend into the unsafe areas? I tried the following to set a background image to the Super View and it doesn't work. // viewDidLoad override func viewDidLoad() { super.viewDidLoad() // Set up…
Ben
  • 3,346
  • 6
  • 32
  • 51
0
votes
0 answers

How to fix iOS10 safe area and topLayoutGuide issue?

I have a question about safe area. And I write a code and build in two simulators of iOS version 10.2 and 11.4. It shows different part of red rectangle area like following image. What's wrong with me? Thanks. code here: class AppDelegate:…
JimmyLee
  • 507
  • 2
  • 7
  • 24
0
votes
2 answers

Top of UIView isn't positioned well when overlayed in iPhone X

I'm currently overlaying a UIView when a button is pressed on top of a viewController. I have it positioned well in other screen devices and when i run in on iPhone X + devices. Its not positioned well. For it to position it well, I need to subtract…
mandem112
  • 181
  • 14
0
votes
1 answer

Top 20px padding in UIViewController when laying out view programatically

I have a custom view that I'm adding to a view controller in viewDidLoad() - var customView : CustomView = CustomView() override func viewDidLoad(){ super.viewDidLoad() self.view.addSubView(customView) customView.topAnchor.constraint(equalTo…
0
votes
0 answers

Swift: Auto Layout - programatically adding a pop-up view

I'm generating a KeyboardView that slides up vertically and then occupies the bottom 1/3 of a view that is used to generate it: class KeyboardView: UIView { private var width: CGFloat! private var height: CGFloat! init(withinView view:…
ajrlewis
  • 2,968
  • 3
  • 33
  • 67
0
votes
1 answer

Xcode Storyboard make button height equal to bottom layout guides (or the space below the safe area) + a constant?

I would like to have my button height to be equal to a constant + the space between the bottom of the safe area and the superview bottom (or what was before called "Bottom layout guides" and set it from the storyboard maybe with a constraint or…
denis_lor
  • 6,212
  • 4
  • 31
  • 55
0
votes
1 answer

iOS 9 Safe Area Top constraint of xib and storyboard is different

on iOS 9, iPhone 5, not happend on iOS 10 and later UIViewController create from storyboard, I set the viewController's red subView's view.top equals to safe area top, the red view is just below the statusBar. If create viewController from xib…
John
  • 65
  • 9
0
votes
1 answer

IphoneX View hidden beside the Tabbar controller's tabbar

I have tabbar controller from one of the tab one view controller is pushed. in pushed view controller there is view (Camera) which is fixed height and with bottom with safearea. This view is hidden beside the tabbar in iPhone X but with other…
Prashant Tukadiya
  • 15,838
  • 4
  • 62
  • 98
0
votes
1 answer

UIStoryboard constraint issue with safe area in iPhoneX (How can I create View with equal height of safe area?)

I did this for bouncing effect in my view. I have a UIViewController, I am placing scrollview in it and a content view (UIView) in scrollview. I have a "LETS GO" button (to go to next screen) at the bottom of content view. I wanted the content view…
Bibek
  • 3,689
  • 3
  • 19
  • 28
0
votes
0 answers

iOS: UITableView won't load cells when left anchor is view.safeAreaLayoutGuide.leftAnchor, but will load if it is just view.leftAnchor

I have a view controller animating in from the left edge of screen, and this view controller has a UITableView subview. On every device and orientation except for one (iPhone X in landscape), this table view shows properly. On the iPhone X in…