Questions tagged [autolayout]

1

votes
1

answer
18

Views

Unable to simultaneously satisfy constraints on UITextField

I am getting the following in the logs when debugging the app. The view still appears and nothing is wrong. How do get rid of this constraint problem? 2019-04-08 13:51:36.006550-0400 Appy[1315:754989] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the co...
Boiler Bill
1

votes
1

answer
3k

Views

layoutIfNeeded affecting table view cells

In my view controller I have a table view as a subview. When the keyboard disappears, I'm using self.view.layoutIfNeeded() to animate the table view. This goes all well except for the table view cells. The cells consists of a few labels, set up with auto layout. When the keyboard disappears, layoutI...
Hendrik Smoels
1

votes
1

answer
3.5k

Views

is there is a way to create constraint greater than or equal relation through code

I'm working on expandable table cell, and my algorithm is follow: I create two views. Create the height constraint of second view, drag it as IBOutlet to my cell. When cell is selected change status of selected cell. class ExpandableCell: UITableViewCell { @IBOutlet weak var expandableCellHeightCons...
dand1
1

votes
3

answer
78

Views

Add uibutton with Auto Layout programmatically

I want to add UIButton like this: let switchTheme: UIButton = { let button = UIButton.init() button.backgroundColor = .red button.setTitleColor(.blue, for: .normal) button.setTitle(Settings.isLightTheme() ? Strings.Various.switchToDark.value : Strings.Various.switchToLight.value, for: .normal) butto...
Evgeniy Kleban
1

votes
1

answer
16

Views

How to distribute 4 components in UITableViewCell with autolayout?

I have a view with an UITableViewCell. In this custom cell like this: I have added the textFields into UIViews, and all uiviews have this constraints with autolayout: but then, when is running on device, all views are distributed with bad forms: The first uiview is deformed How could I add the const...
user3745888
1

votes
0

answer
34

Views

How should I approach dynamic layout in my app based on the information from my backend?

I am building an app which will receive data from my backend and provide dynamic layout in the app. Let me explain. Let's say I am building an image editing app which let's you place text, png stickers etc on the image. The app needs to have templates which can place the text, stickers etc on the im...
Pranoy C
1

votes
1

answer
291

Views

xcode ios - how to make an image fit into different screen sizes

I am making an iOS app. Basically several login fields with a logo on top. The storyboard should simply fit device screen width. I have started with a Scroll View (to make sure everything is available when the keyboard pops up). The Scroll View has constraints: top 0, left 0, right 0. Then I have pu...
filo
1

votes
0

answer
106

Views

Full screen map when button tapped

I would like to display a map in full screen when a button placed on it, is tapped. My ViewController looks like this (from top to bottom) : SearchBar -->Map -->Tableview I have set constraints for the map (autoLayout) : 0 for leading, trailing, top to Searchbar, bottom to TableView 125:49 Ratio I p...
scienst
1

votes
2

answer
51

Views

How to fix shrinking label?

So, I have more than one label inside my uitableviewcell. I'm using autolayout for the ui. But I got some weird behaviour on one of my labels. Here is the video: That one label that starts with 'untuk' keep changing its size whenever I reload the tableview and I got below warning on the storyboard:...
Ega Setya Putra
1

votes
1

answer
111

Views

Unable to simultaneously satisfy constraints. Although no duplicate/unwanted constraint is defined

Title may sound a duplicate, but I have been trying to resolve it for hours, but I couldn't find any duplicate or unwanted constraint. Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each cons...
Bista
1

votes
1

answer
384

Views

Auto-layout issue with stack view and label's font size

I really wanted to figure this out by myself but it's been 3 hours now and I don't think this kind of problem is worth half that amount of time so here I am seeking for help. This is an auto-layout problem so I will try my best to illustrate it correctly. I have a stack view containing two labels (O...
Wizzardzz
1

votes
0

answer
85

Views

Adjust Table View Cell custom view constraint after image loaded from url

In my application, I have a uitableview whose cell height is measured by autolayout UITableViewAutomaticDimension. The cell contains an image, whose height is adjusted by a NSLayoutconstraint outlet connected to cell. Image is loaded from a URL. Sometimes the URL will returns 'No Image'. At this p...
vinu
1

votes
1

answer
192

Views

Custom UITableViewCell height changes when moved

I am using Autolayout and estimatedHeightForRowAtto dynamically change cell height. This is the code I am using: var heightAtIndexPath = NSMutableDictionary() func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { let height = self.heightAtIndexPath.objec...
Osama Naeem
1

votes
0

answer
80

Views

ImageView inside StackView moved to the edge of the screen on iOS 11

I've got a view that contains vertical StackView: Alignment - Fill Distribution - Fill Proportionally Spacing - 15 that contains several horizontal StackViews: Alignment - Fill Distribution - Fill Proportionally Spacing - 10 in which there is an ImageView and Label which can have text in 2 lines....
user3448282
1

votes
1

answer
468

Views

How to setup auto layout constrains so that UILabel stays vertically centered inside UIScrollView

How should I setup auto layout constrains so that multiline label stays vertically centered inside scrollview until it's text content becomes too long to be shown at once? When the text length becomes too long text should be aligned at top with the scrollview so the user can see the beginning of tex...
Code Poetics
1

votes
1

answer
28

Views

UIViewController - top misaligned at cold launch on iOS 9/10, ok on 11

I have a UIViewController that contains a UISegmentControl at the top, and a UITableView below. The layout is very simple. The UISegmentControl Top Margin is 16pts from the Top Layout Guide. The tableView is relative to the UISegmentControl. The view is part of a UITabBarController set. The UIT...
Mitch Cohen
1

votes
1

answer
25

Views

Automatic height of static UITableViewCell with autoLayout not updating in IB (but works when run)

I'm relatively new to Storyboarding and IB, and am a little stuck on this. I have some content (a text view in one cell and a label in another) with autolayout constraints to the cell content view. When I run in simulator, the cells heights are being set correctly based on the contents, but in IB th...
Jesse
1

votes
1

answer
116

Views

iOS Update Interface Builder view frame based on constraints

I am building my views in Interface Builder and I am using AutoLayout constraints. Whenever I create a Table View Cell I use Automatic Dimension so cell's heights are calculated properly. The problem is that cell frame in interface builder is not updating on its own (I mean the whole view's cell) T...
XFawkes
1

votes
2

answer
1.8k

Views

Constraints ambiguously suggest a height of zero for tableview cell's content view

This warning is driving me crazy: [Warning] Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell's content view. We're considering the collapse unintentional and using standard height instead. I have a UICollectionView inside a UITableViewCel...
Bassel
1

votes
2

answer
60

Views

Constraint animations will only move up, won't move down

I have two buttons that trigger animations on two objects — a view and an imageView — whose positioning is set by auto layout. (While trying to problem solve this I simplified the destinations to be the top and bottom of the screen.): @objc func upButtonTapped() { self.logo.centerYAnchor.constr...
MT1asli8ghwoi
1

votes
1

answer
197

Views

How to make button stick to bottom of scroll view if the content isn't large enough? [duplicate]

This question already has an answer here: Label doesn't show all the text inside scrollView 4 answers This is what happens if there is an equality constraint of 20 between the button and the label and the label has a lot of text: This is what happens if the text is small: As you can see, the button...
Toma Radu-Petrescu
1

votes
0

answer
27

Views

How to implement CollectionView for a slide show with prominent looking levels in iOS?

I have an image slideshow where first image is prominent while previous and next image will appear back of current image? Something like Also with the page control bubbles ?
starterMac
1

votes
0

answer
122

Views

Make `NSScrollView` large enough to fit document view but not so large it will make the window overflow the screen

Problem This is an issue I'm having with an open source Cocoa framework I'm developing, EasyDialogs. The goal is to programmatically display a form (a bunch of controls) inside a window, and automatically resize the window to a 'sensible' size that is never larger than the screen. However when open...
Marco83
1

votes
1

answer
67

Views

Automatically increase size of UIViewController containing a UIStackView

I am trying to achieve a pretty complex view hierarchy. My idea is to build a UI similar to the AirPods and HomePod configurator sheet showing from the bottom part of the screen. I have a fullscreen UIViewController which has a child view controller of type UINavigationController. In this navigation...
BalestraPatrick
1

votes
2

answer
128

Views

How to increase a XIB view based on it's contents?

I have a XIB which is of this size: (width: 300, height: 100) while designing. It has 3 labels which will be expanding based on its content. I am simply loading that XIB and adding it to the self.view. Is there a way that I can easily increase the XIB view height as UILabel increases? I have success...
Hemang
1

votes
0

answer
59

Views

Lower textfields embedded in scrollview not receiving touches

I have a lot of textfields arranged vertically in a scrollview and at the very bottom one textview. All are wired in storyboard to outlets in a .h file and also to action methods that trigger a method to enable a save button. All have their delegates set in viewdid load. However, the bottom textf...
user6631314
1

votes
1

answer
247

Views

VS for Mac - Using Autolayout for landscape and portrait views

I need help, having spent the day searching through various youtube videos and google etc I've hit that wall! I'm using Visual Studio for Mac and basically, my Logon screen looks good in Portrait but not so in Landscape so I want to show a different view with a redesigned screen especially for Lands...
Clandestine
0

votes
0

answer
5

Views

Why doesn't the UILabel show when the simulator is in Landscape Mode?

I want to make this UILabel show correctly in the landscape mode of the iPhone simulator. I think that I have already made fine constraints with AutoLayout mechanism. Here is my StackView constraints: Here is my CountLabel constraints: When switching to the landscape mode: What I expect is: Please h...
Sunset Wan
1

votes
0

answer
91

Views

Labels are overlapping with autolayout?

I have constraints placed on my two labels. Both have leading constraints, the top one has a vertical space to safe space constraint and then the bottom has a top space to the top label. Both my tableView and TableCell have the adequate row height and the connections have been deleted and reconnecte...
jonpeter
1

votes
0

answer
40

Views

In ambiguous layout error message, what does “id” mean?

The console error looks like *Feather-1:0x7fa8f7612530- AMBIGUOUS LAYOUT for Feather-1.minX{id: 61}, Feather-1.minY{id: 65} What are the {id: 61} and {id: 65} all about?
Andrew Duncan
1

votes
1

answer
68

Views

Autolayout debug build differs from release build

I have a containerview that holds a UITableview. With the debug build everything looks good- But with the release build the childviewcontroller appears inset- Here is the storyboard for the containerview- And here is the code instantiating the view- self.dailyWeatherTableViewController=[[UIStoryboa...
David
1

votes
2

answer
268

Views

autoResizingMask for inputAccessoryView not working

I'm trying to cope with iPhone X with inputAccessoryView. I've added a view to my ViewController like so: CustomView I've defined an outlet and attached to it. Returned the same view as inputAccessoryView like so: class ViewController: UIViewController { @IBOutlet weak var textFieldContainer: UIView...
Muhammad Hassan
1

votes
0

answer
498

Views

iOS: adding buttons to Toolbar programmatically

I need to create Toolbar and add buttons programmatically. I will have different sets of buttons for diferent screens. That's easy. Also, I need to center those buttons. They should have equal space between them. And also I need that all those buttons separate screen width only between themselfs....
Marksss
1

votes
1

answer
116

Views

ChildViewController + ContentSize + Autolayout

Is it possible to manage frame of childViewController in the same way like subviews? I mean, is childViewController can calculate frame based on content, like for example UILabel based on inserted text? I use intrinsicContentSize to determine contentSize of custom UIViews. I found preferredContentSi...
1

votes
3

answer
206

Views

How to load UIWebView underneath Navigation bar until StatusBar

Hi I have a VC with a UIWebView and a NavigationBar. When I set the Top Constraint of my webview.Top to Superview and the constant to 0, The web view does not load until the status bar and only load until the navigation bar. Why is it like that? See the following pic. Then if I set the webView.Top t...
Hanz Cheah
1

votes
0

answer
36

Views

Nonidentity Multipliers of Constraint Equations for Location Attributes in IOS Auto Layout

According to the Apple Auto Layout Guide: You cannot use a nonidentity multiplier (a value other than 1.0) with location attributes. If I understand the so-called nonidentity multiplier correctly, the multiplier should always be 1.0 when setting up a constraint for the location attribute. But I trie...
marcel
1

votes
1

answer
44

Views

iOS - Autolayout issue in table view cell

I have a table view cell with the following items: Image View (343 x 193) Label 1 (height: 17) Label 2 (height: 20) I want the image to maintain the same aspect ratio no matter what the device is (this app only works on iPhone, not on iPad). What I'm doing is adding the following: Image View: Aspect...
cesarcarlos
1

votes
1

answer
265

Views

Creating an Input Accessory View programmatically

I'm trying to create a keyboard accessory view programmatically. I've set up a container view and inside that I'm trying to set up a textfield, post button, and an emoji. Here's an example of what I'm trying to make. Click here to view the image. Here's the code that I am working with. I think th...
Dipali Bajaj
1

votes
2

answer
361

Views

How to use Safe Area Layout Guide without Autolayout?

I would like to compact my iOS app also in iPhone X. This iOS app developed using autoresizing and deployment target is iOS8. I had chosen my viewcontroller in storyboard.Then I tried to check Use Safe Area Layout Guide but it automatically appear check mark on Autolayout.Please go through the image...
IKKA
1

votes
1

answer
75

Views

How to update the layout (position) of a popover when its source view changes theirs in Swift?

I want to update the layout of a popover, I've already tried using the setNeedsLayout() and layoutIfNeeded() methods but couldn't find a solution. I have a simple screen with 4 buttons that call a popover, within the popover there are 2 extra buttons: Button -> hides button3, and moves button1 and b...
aaronmhr

View additional questions