Questions tagged [autolayout]

Auto Layout is a constraint-based, descriptive user interface layout system for OS X and iOS.

autolayout
Filter by
Sorted by
Tagged with
-1 votes
1 answer
18 views

Why are the contents of an NSScrollView aligned to the bottom instead of the top?

I'm trying to use an NSScrollView where the contents may be (vertically) smaller or taller than the window, changing dynamically at runtime. (This will later be a stack view with multiple views that ...
fbitterlich's user avatar
0 votes
0 answers
40 views

Align image inside DTImageTextAttachment

I am trying to add an image to DTAttributedTextContentView and align it using DTImageTextAttachment like so: func addAndDisplayImage() { guard let image = UIImage(named: "test") else { ...
Andrew's user avatar
  • 25
1 vote
1 answer
44 views

How to right align a UIStackView inside a UIScrollView when the stack view's size is smaller than scroll view?

Please look at the below picture of my storyboard to understand the layout of my views. On the left side is a horizontal UIStackView with 2 buttons. This is okay. On the right side of the above stack ...
sudoExclamationExclamation's user avatar
0 votes
0 answers
17 views

UIView animation layoutIfNeeded causes top Constraint to break at the start of animation if not called on superview

I am able to demonstrate the issue with the below simple example code. I basically have a custom View (sort of like a nav bar) on which I animate the bar to hide/show the blue area (which will contain ...
sudoExclamationExclamation's user avatar
0 votes
1 answer
55 views

Sizing DTAttributedTextContentView based on its attributedString

I am trying to self size DTAttributedTextContentView inside the collection cell based on its attributed text. The problem I face is that when I set attributedTextContentView width constraints like so: ...
Andrew's user avatar
  • 25
0 votes
0 answers
22 views

Can't locate storyboard constraints warnings in Xcode

Xcode is flagging constraint warnings up in the Issues Navigator pane, but when I select any of them, it doesn't take me to where the error should be in the storyboard / doesn't highlight any of the ...
Lena Verhoev's user avatar
-1 votes
1 answer
36 views

layerClass breaks auto layout

I made a custom view which has CAGradientLayer as a layer, and I added this view on the other view with bottom anchor. It was just very simple auto layout constraint with bottom, leading, trailing and ...
Ryan's user avatar
  • 4,874
0 votes
1 answer
40 views

AppKit NSTextField and AutoLayout : how to set programmatically a specific width?

I'm porting my multi-platform C++ framework to the Mac, leveraging the AppKit in Objective C. Just like in Windows, I'm leveraging the auto layout capabilities of the host which works fine for buttons ...
alphafox75's user avatar
0 votes
2 answers
97 views

How to dynamically controls constraint to active them without manually doing calculation and set active by my self?

I want the text label adjust its position based on the green view. It should left alignment to the view if possible, but if the text content extent out of the dashboard, I'd like the text to right ...
Nandeba's user avatar
0 votes
1 answer
65 views

UILabel not drawing text properly in UICollectionViewCell

I have a UILabel that sits inside a UICollectionViewCell. The UILabel is multiple lines and may be different sizes based off of the text supplied. The cell sits in a collectionview with a simple ...
Moses Harding's user avatar
0 votes
0 answers
37 views

iOS: When layoutIfNeeded() is called on a specific subview, it is not displayed on the screen

I am dynamically adding and displaying a custom view. At this time, the custom view has subviews. When showing a custom view and additionally showing internal subviews, I am curious as to why the ...
sweetSwift's user avatar
3 votes
0 answers
242 views

Modifications to the layout engine must not be performed from a background thread on iOS 17 and above

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modifications to the layout engine must not be performed from a background thread after it has been accessed from ...
Vimal's user avatar
  • 59
0 votes
1 answer
105 views

Content hugging and content compression resistance with minimum margin between views

I was trying to create a UI with two labels placed horizontally in parallel to other edges on the screen so that they can grow according to the content they receive. and I tried setting up content ...
Maverick's user avatar
5 votes
1 answer
220 views

Auto Layout Constraint Conflict in SwiftUI When Tapping TextField

I am developing an iOS app using SwiftUI and have encountered an Auto Layout constraint conflict issue that appears when tapping on a TextField within a LoginView. I've tried several troubleshooting ...
bublwrap2100's user avatar
-1 votes
1 answer
59 views

NSStackView giving too much space to collection view despite constraints

I have an NSStackView containing an NSImageView and an NSCollectionView. Both of these items are wrapped in their own NSScrollView: Desired behavior I want the collection view to take up only as much ...
Nick K9's user avatar
  • 4,216
0 votes
1 answer
29 views

UICollectionView - constraints warning when I reselect item

I have custom UICollectionView class MyCollectionViewCell: UICollectionViewCell { var v0: UIImageView = { let iv = UIImageView() iv.image = UIImage() iv.contentMode = ....
Martin Perry's user avatar
  • 9,443
0 votes
1 answer
29 views

UIButtons do not respond to touched on ViewController with UIScrollView

I am working on the ViewController with UIScrollView embedded in. I've got: view -> scrollView -> contentView (UIView) -> backgroundImageView -> SettingsItemsView (UIView) -> UIButtons. ...
Vladimir Kovalev's user avatar
0 votes
1 answer
50 views

Xcode safe area moved and now can't edit layout

In Xcode I'm trying to add some auto layout constraints to my app, but in the Interface Builder the bottom button keeps pinning to the bottom of the screen. That's technically doing what I told it to ...
Connor Michael Winter's user avatar
2 votes
0 answers
167 views

Got Fatal Exception NSInternalInconsistencyException on iOS 16 only

I've gotten stuck at this firebase crashlytic report CoreAutoLayout NSISLinExpReplaceVarWithVarPlusDelta. While reading stack trace it seems like I suddenly perform autolayout update on background ...
sonle's user avatar
  • 5,832
-1 votes
1 answer
37 views

UIImageview is not scaling to its frame when image is set

Here I have attached the screenshot that I have worked. I am facing an issue that image view is not scaling to the frame. I have created a custom view within the custom view i have added imageview and ...
Arun's user avatar
  • 91
-1 votes
1 answer
108 views

UIPageViewController inside a UIStackView or UITableView [closed]

I was trying to create an onboarding UI using UIKit and Storyboard. I had a requirement where some parts needed to be static / sticky and some parts had to scroll horizontally as the user swiped on ...
Shawn Frank's user avatar
  • 4,781
0 votes
0 answers
20 views

Show element by clicking/hovering on different element

Fairly new to Figma and I kindof understand how components work. But what I'm trying to do is change element 1 from variant 1 to 2 (visibility on/off) based on hovering on element 2. More specifically,...
SpectraXCD's user avatar
0 votes
2 answers
85 views

UIButton frame size doesn't update to support increased font size from settings

I have a basic UIButton with the following constraints: I have some basic trailing and top constraints and I have a >= width and height constraint set to 48 as I want 48 to be my minimum width and ...
Shawn Frank's user avatar
  • 4,781
0 votes
1 answer
48 views

how to make Youtube mainView like sticky header view

In Youtube Home, when its scroll is down, youtube logo area is disappearing. When it is dragged up, the first behavior is Youtube logo area is coming down and only then the scrollview can be scrolled. ...
Bravo's user avatar
  • 17
0 votes
2 answers
52 views

Set maxwidth on UITextfield

I have a Uitextfield, I want the leading and trailing to be 23 from the safe area or superview when the device width is less than 580 making it grow as wide as the device screen but 23 from both edges....
Michael Okoli's user avatar
0 votes
1 answer
142 views

Set the same font size for two labels within a horizontal stack view with autolayout and authoshrink

I need to create a view in which I want to have two labels side by side with equal spacing. The problem is that those labels will have different texts depending on the backend response. I want to ...
wasi's user avatar
  • 11
0 votes
0 answers
91 views

iOS AutoLayout issue(Tabman & SnapKit): Having trouble aligning the bottom of one container with the top of safe area

I'm having problems with autolayout(I'm using SnapKit). I use Tabman (Tabman doc is here) to create my Home View. I use Tabman's API to create custom layout for tabs. Here is my code: import UIKit ...
Austie Chou's user avatar
0 votes
1 answer
39 views

iOS UIkit ViewDidLayout Calls On Handle Drag

App has 2 different parts. Rectangle view and button. Rectangle view can drag with pan touch gesture. Button can change own image with tap gestures. When user taps the button, it changes own image. ...
mkemalgokce's user avatar
0 votes
1 answer
30 views

UIImage Sizing in Dynamic Collection View Cell with Autolayout and UICollectionViewCompositionalLayout

Context: I have a collection view with dynamic cell height defined by its cell's content. The cell's content: a UIView, a UILabel, and a UIImage (image and label vertically positioned). Problem: ...
robinyapockets's user avatar
0 votes
1 answer
252 views

Teaser Carousel View using UIScrollView programatically

I want to implement a teaser carousel view(that is partial left and right view shown in the viewport along with the main view centered) using UIScrollView. View Hierarchy: ViewController -> ...
Aniket Prakash's user avatar
0 votes
0 answers
19 views

Can't create trait variations for constraints

Hi I'm having a problem adding constraints that are installed based on size classes. I'd like to have certain constraints be installed on compact vertical traits. I have enabled Use Trait Variations ...
Build's user avatar
  • 100
0 votes
0 answers
55 views

How does Auto-Layout resolve constraints internally?

IMPORTANT: I know how to use Auto-Layout. How to use it has been asked before already and this is not a duplicate of that question. Auto-Layout is Apple’s cross-platform constraint-based layout system....
Sjwjsjws shsis's user avatar
-1 votes
1 answer
38 views

Cell content constraints programmatically

I am trying to redo my project programmatically with no storyboard. I have a tableView with a prototype cell. The cell contains an imageView (briefcase), firstLabel (at the top) and secondLabel (right ...
CalebGates's user avatar
1 vote
2 answers
108 views

Couldn't layout Subviews in UITableViewHeaderFooterView

I'm trying to make a custom header for 0 section of my UITableView. Here's the code I'm using to create this header: class ProfileHeaderView: UITableViewHeaderFooterView { // MARK: - Subviews ...
Philipp's user avatar
  • 333
0 votes
0 answers
30 views

iOS Two custom views of dynamic height Autolayout

I'm working on autolayout, but I couldn't fix the error, so I'm posting for advice. I am working on the cell of Table View which has two custom Views. The views in question are Feed Content View and ...
Cook Kim's user avatar
0 votes
2 answers
100 views

AutoLayout layoutIfNeeded bounds update time

I have the following code in my custom UIView. This gets called from init(frame:) or init(coder:) initializer: private func setupContentView() { contentView = ContentView(frame: .zero) ...
Deepak Sharma's user avatar
1 vote
0 answers
42 views

Swift StoryBoard Auto Layout

enter image description here enter image description here I've been trying to work with Swift Auto Layout all day, but it's not going as planned, so I'm asking for help. I'm trying to accomplish two ...
선준우's user avatar
0 votes
1 answer
222 views

Constraints a view to the bottom of WKWebView.scollView

I am trying to put a view at the bottom of the contentView of my WkWebView.scrollView, but it seems like the view always end up at the origin Y of 5000 or 8000 which is the random value of bound ...
Steven-Carrot's user avatar
1 vote
1 answer
44 views

Issues with dynamic height UIStackView using autolayout

I am trying to create a horizontal axis UIStackView with 2 views, a label and an image, that would look something like this: Blue is the label Image is the image The frame of the UIStackView is the ...
Shawn Frank's user avatar
  • 4,781
0 votes
0 answers
35 views

I am trying to add size constraints to a button in Xcode 14. It appears that the constraints have been added but I see no physical change

Screenshot from Xcode (I am using a tutorial from Udacity that was made in 2016, so the Xcode is different. I have followed the steps in the tutorial but I am not getting the same result). I have ...
Emmanuel Fadugba's user avatar
1 vote
2 answers
57 views

How to obtain an approximately square multiline UILabel using Autolayout

I'm putting a multiline UILabel into a popup. The text has a variable length. What I'd really like to do is get a size that is approximately square—so that when displayed it has a nice appearance. If ...
David H's user avatar
  • 41.2k
0 votes
0 answers
67 views

Unable to simultaneously satisfy constraints when adding UITabBarController into UIView

I programmatically add UITabBarController into UIView. That causes console warnings I can't understand and remove. Despite that, in simulator everything is placed as desired. final class ...
Alexey_BH's user avatar
  • 133
1 vote
1 answer
31 views

UICollectionView Cell Layout Issue

I'm working on a UICollectionView that contains cells with an image and a label. I've created a three-column flow layout. However, I'm encountering an issue where the cells appear to be huge and out ...
Alexander Paul's user avatar
0 votes
1 answer
39 views

Programmatically added gradientLayer does not clip to UIView added through Storyboard

I have a prototype cell where I set a UIView in the back to have a solid background color (blue, to see the content clearly in Storyboard). Then I decided to make this background color a gradient at ...
CalebGates's user avatar
0 votes
1 answer
59 views

insertSubview() is working on one UIView in UIStackView, But not on adjacent view

I am working on autolayouts in storyboard, I have two adjacent UIViews in a single UIStackView. I need to insert image in both UIView background. Problem is that background image is showing in left ...
Muhammad Haroon Iqbal's user avatar
1 vote
0 answers
70 views

Compositional CollectionView Layout width constraint doesn't work

Following code is my compositional collectionview flow layout customization code for item and group. I want to calculate both height and width using auto layout but width constraint doesn't work. I ...
Ogün Birinci's user avatar
0 votes
2 answers
139 views

iOS adjusting bottom constraint constant of view when keyboard visible has a larger offset on newer model iPhones

I am setting up my keyboard will show notifier, getting the keyboard height, and setting the constant value on the bottom constraint as shown here: Notification Observer NotificationCenter.default....
Zachary Bell's user avatar
0 votes
0 answers
45 views

Autolayout does not work correctly for groups of nodes. Where did I go wrong? Dargre-d3-es

I use the library dagre-d3-es Autolayout does not work correctly for groups of nodes. I made an autolayout for nodes, but when I use groups, the position for this group is not set correctly. I put all ...
Anton's user avatar
  • 1
0 votes
1 answer
30 views

Adding image view constraint programmatically

The collectionview cell I created has a vertically limited space. I want to put an imageview and label on the vertical axis. But I want this image view to grow or shrink according to the screen size. ...
Ogün Birinci's user avatar
0 votes
1 answer
94 views

UICollectionViewCell constraint error after reloadData

This is my custom UICollectionViewCell code. I am only giving a constraints for the subviews in the configureViews() function. class CategoryCell: UICollectionViewCell { private lazy var nameLabel: ...
Ogün Birinci's user avatar

1
2 3 4 5
222