uistackview

UIStackView “Unable to simultaneously satisfy constraints” on “squished” hidden views

China☆狼群 提交于 2019-11-28 16:27:17
When my UIStackView "rows" are squished, they throw AutoLayout warnings. However, they display fine and nothing else is wrong besides these sorts of loggings: 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 constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property

UITableView not shown inside UIStackView

时光怂恿深爱的人放手 提交于 2019-11-28 01:29:19
问题 I have a UIStackView where it can show a label, image, table view or nothing based on user selection. Here is my current hierarchy for the dynamic view: UIStackView_Parent UILabel - some text, fixed view UIStackView_Child - this is the container that can show multiple things or nothing UIView - another fixed view When I call UIStackView_Child.addArrangedSubview(...) with a label or image it works perfectly, but addArrangedSubview(tableView) does not show the table. I have tableView

Adjusting UIView Height Inside UIStackView Control

只愿长相守 提交于 2019-11-28 00:40:53
I am using a UIStackView in iOS 9 SDK. The height of the stackview is 44 points. I have a UILabel and UIView inside the StackView as shown below: Now, I want to make the green view much smaller than 44.. much like 20. How can I do that? UPDATE: Without the UIStackView I am getting breaking constraints: [GT.BubbleView:0x14536610] (Names: '|':UITableViewCellContentView:0x14536fd0 )>", "<NSLayoutConstraint:0x146b7300 GT.BubbleView:0x14536610.trailing == UITableViewCellContentView:0x14536fd0.trailingMargin>", "<NSLayoutConstraint:0x146c4000 'UIView-Encapsulated-Layout-Width' H:

Negative spacer for UIBarButtonItem in navigation bar on iOS 11

好久不见. 提交于 2019-11-27 19:04:45
In iOS 10 and below, there was a way to add a negative spacer to the buttons array in the navigation bar, like so: UIBarButtonItem *negativeSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; negativeSpacer.width = -8; self.navigationItem.leftBarButtonItems = @[negativeSpacer, [self backButtonItem]]; This no longer works on iOS 11 (the spacer becomes positive, instead of negative). I have inspected the view hierarchy of the bar button item, and it is now embedded into _UIButtonBarStackView . How to adjust the position of the bar

Multiline label in UIStackView

馋奶兔 提交于 2019-11-27 17:00:49
When putting multiline label (with linebreak set to Word Wrap) into a stack view, the label immediately loses the linebreak and displays the label text in one line instead. Why is this happening and how does one preserve multiline label within a stack view? The correct answer is here: https://stackoverflow.com/a/43110590/566360 Embed the UILabel inside a UIView (Editor -> Embed In -> View) Use constraints to fit the UILabel to the UIView (for example, trailing space, top space, and leading space to superview constraints) The UIStackView will stretch out the UIView to fit properly, and the

Overlapping Views in UIStackView

我们两清 提交于 2019-11-27 14:40:25
问题 I have an horizontal stack view that I added arranged sub views to it (7 cells). Each one of the cells in the stack has a circular badge that exceeds the view boundaries (negative constraint). When running, as you can see below, each cell is on top of the badge of the previous cell. I would like to change the order so that the badges will be fully visible. Tried playing with the Z index but it didn't help as the layers are somehow not flat as you can see in the following view hierarchy: Any

UIStackView Hide View Animation

走远了吗. 提交于 2019-11-27 07:23:06
In iOS 11 the behaviour of the hide animation within a UIStackView has changed, but I have been unable to find this documented anywhere. iOS 10 iOS 11 The code in both is this: UIView.animate(withDuration: DiscoverHeaderView.animationDuration, delay: 0.0, usingSpringWithDamping: 0.9, initialSpringVelocity: 1, options: [], animations: { clear.isHidden = hideClear useMyLocation.isHidden = hideLocation }, completion: nil) How do I restore the previous behaviour on iOS 11? Springham Just had the same issue. The fix is adding stackView.layoutIfNeeded() inside the animation block. Where stackView is

Is it possible for UIStackView to scroll?

↘锁芯ラ 提交于 2019-11-27 02:21:23
Let's say I have added more views in UIStackView which can be displayed, how I can make the UIStackView scroll? Arjan In case anyone is looking for a solution without code , I created an example to do this completely in the storyboard, using Auto Layout. You can get it from github . Basically, to recreate the example: Create a UIScrollView , and set its constraints. Add a UIStackView to the UIScrollView Set the constraints: Leading , Trailing , Top & Bottom should be equal to the ones from UIScrollView Set up an equal Width constraint between the UIStackView and UIScrollView . Set Axis =

Adjusting UIView Height Inside UIStackView Control

限于喜欢 提交于 2019-11-26 21:48:17
问题 I am using a UIStackView in iOS 9 SDK. The height of the stackview is 44 points. I have a UILabel and UIView inside the StackView as shown below: Now, I want to make the green view much smaller than 44.. much like 20. How can I do that? UPDATE: Without the UIStackView I am getting breaking constraints: [GT.BubbleView:0x14536610] (Names: '|':UITableViewCellContentView:0x14536fd0 )>", "<NSLayoutConstraint:0x146b7300 GT.BubbleView:0x14536610.trailing == UITableViewCellContentView:0x14536fd0

Multiline label in UIStackView

杀马特。学长 韩版系。学妹 提交于 2019-11-26 17:55:22
问题 When putting multiline label (with linebreak set to Word Wrap) into a stack view, the label immediately loses the linebreak and displays the label text in one line instead. Why is this happening and how does one preserve multiline label within a stack view? 回答1: The correct answer is here: https://stackoverflow.com/a/43110590/566360 Embed the UILabel inside a UIView (Editor -> Embed In -> View) Use constraints to fit the UILabel to the UIView (for example, trailing space, top space, and