Questions tagged [autolayout]
Auto Layout is a constraint-based, descriptive user interface layout system for OS X and iOS.
11,055
questions
0
votes
1
answer
39
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 ...
0
votes
1
answer
43
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 ...
-1
votes
1
answer
36
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 ...
0
votes
1
answer
26
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 = ....
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. ...
0
votes
1
answer
39
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 ...
1
vote
0
answers
77
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 ...
-1
votes
1
answer
32
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 ...
-1
votes
1
answer
83
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 ...
0
votes
0
answers
13
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,...
0
votes
2
answers
56
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 ...
0
votes
1
answer
36
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. ...
0
votes
2
answers
36
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....
0
votes
1
answer
76
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 ...
0
votes
0
answers
61
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
...
0
votes
1
answer
38
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. ...
0
votes
1
answer
26
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: ...
0
votes
1
answer
118
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 -> ...
0
votes
0
answers
16
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 ...
0
votes
0
answers
40
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....
-1
votes
1
answer
37
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 ...
1
vote
2
answers
55
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
...
0
votes
0
answers
29
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 ...
0
votes
2
answers
54
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)
...
1
vote
0
answers
36
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 ...
0
votes
1
answer
131
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 ...
1
vote
1
answer
41
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 ...
0
votes
0
answers
32
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 ...
1
vote
2
answers
38
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 ...
0
votes
0
answers
48
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 ...
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 ...
0
votes
1
answer
37
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 ...
0
votes
1
answer
50
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 ...
1
vote
0
answers
60
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 ...
0
votes
2
answers
59
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....
0
votes
0
answers
31
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 ...
0
votes
1
answer
27
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. ...
0
votes
1
answer
88
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: ...
0
votes
2
answers
136
views
Autolayout constraints push content outside of the view
This question is being updated every time I act on someone's suggestion here. Unfortunately though, non of the minor housekeeping suggestions helped enough, so the problem remains.
In the nutshell:
I ...
0
votes
0
answers
23
views
Button Bottom space showing different in different iPhone sizes in swift
this is the design hierarchy in storyboard
here why buy ticket button bottom space varies for different screen sizes.
for buy ticket i have given bottom space to superview 90 like this
and for ...
0
votes
0
answers
33
views
UITableView Custom Cell Auto-Resizing with TextView & ImageView
I have a table view with a custom cell that will display comments from users. In the view conrtoller where the table view is located, I make a network call to fetch the comments and the related images ...
0
votes
0
answers
45
views
swift collectionCell reuse strategy makes image display incorrect
My target: stop animated image in every cell. However, only the first three cell stop successfully at beginning. If I scroll to the fourth or fifth cell, the image is not stoping. Just like the demo ...
0
votes
1
answer
126
views
Layout issue with UIStackView with distribution .fillEqually is ignoring spacing
I have a layout issue I'm struggling to fix. I have a stack view in a tableview cell and I am trying to programmatically add images with different layouts based on the number of images. There's one ...
0
votes
1
answer
51
views
Layout broken when pushing VC into a UINavigationController presented with a custom transition
I have an extension for performing transitions between view controllers. It will perform an animation with the views of each VC and then replace the current vc with the destination vc using this ...
0
votes
1
answer
60
views
UITableViewCell height problems
I'm trying to configure my tableViewCell but some problems with layouts.
This is my view controller:
Here is my xib file with cell:
And how it works:
Code for ViewController:
class ...
0
votes
1
answer
23
views
How to connect xib's view to another viewcontroller's view in swift?
I have a question about view.
How to let mainVC xib's view connect menuVC's view?
Why I set this code and not work to show background color?
self.cvBottom = menuView
Or I miss something to set?
...
1
vote
1
answer
244
views
UICollectionView does not load all visible cells
I have a UICollectionView with some headers and (various-sized) cells. The issue I got with it's that it looks like it doesn't load all the required cells to fill the visible area, but instead it only ...
0
votes
1
answer
62
views
Central Y align a textfield within a UIScrollView in Xcode
I have a UIScrollView which contains a UILabel with a UITextField directly beneath it.
The scrollview is there to bump up the textField when the keyboard opens for editing
I'm a bit confused to how I ...
0
votes
1
answer
107
views
Swift ImageView's top Constraints looks wrong and covered its superView?
I want to achieve a "show more" effect in my view. The desired effect is as follows(sorry for my poor painting), the view's height is set to a specific value at first(such as 304), and when ...
0
votes
2
answers
119
views
swift scrollView subview width always 0?
I met a strange problem, the subviews width is always 0 when I add it as subview of scrollView, but it works when I give the subview a specific number such as make.width.equalTo(200).
I was wondering ...