uistackview

UILabel in UIStackView

倾然丶 夕夏残阳落幕 提交于 2020-01-06 08:01:31
问题 While I put a single UILabel into the stack of UIStackView, everything works fine as expected. But what I need is to actually put a UIView under the UILabel and keep the self-size of UILabel to be kept. I just wondering, is there is a way to achieve this without using UITableView and self-sized cell? I used this code let textLabel = UILabel() textLabel.text = "zaciatok TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT

UILabel in UIStackView

限于喜欢 提交于 2020-01-06 08:01:10
问题 While I put a single UILabel into the stack of UIStackView, everything works fine as expected. But what I need is to actually put a UIView under the UILabel and keep the self-size of UILabel to be kept. I just wondering, is there is a way to achieve this without using UITableView and self-sized cell? I used this code let textLabel = UILabel() textLabel.text = "zaciatok TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT TEXT TEXT TEXTTEXT

Ios show/hide views inside a tableview cell

随声附和 提交于 2020-01-04 05:31:12
问题 I have a tableview with a custom cell. Below image shows the view hierarchy of my tableview cell. When adding rows to the tableview I'm hiding the 'check Image' imageview using below code. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "accountCell", for: indexPath) as! AccountsTableViewCell cell.checkImage.isHidden = true return cell } and when a row is clicked I'm showing the imageview

Flipping the positions of items in a UIStackView

强颜欢笑 提交于 2020-01-03 16:54:12
问题 I have a UIStackView , created in Interface Builder that contains two views. Now I'm trying to programatically change the order of these views (exchange their positions, so to speak). Is there an easy fix for this that DOES NOT use Interface Builder to accomplish this? Thanks :). 回答1: Create a layout with 2 UIViews in a UIStackView like so: Create an outlet for your UIStackView to your UIViewController . Call addArrangedSubview on your UIStackView in viewDidLoad to change the order. See

how to use Stack View of object library in Xcode 7

南楼画角 提交于 2020-01-01 09:44:24
问题 I recently installed Xcode 7 beta and found something new in object library like Horizontal stack view and Vertical stack view . When i put some controls inside it, stackview seems to be resizable according to the control size. When i present more controls the stack seems to be adjust automatically as of the stack view. Either adjusting horizontally or vertically? Is it derived from some other mobile platform 回答1: A major advantage of using UIStackView is it uses Auto Layout to position and

UIStackView Hide View Animation

早过忘川 提交于 2019-12-28 02:38:12
问题 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? 回答1: Just had the same

Is it possible for UIStackView to scroll?

社会主义新天地 提交于 2019-12-28 01:38:12
问题 Let's say I have added more views in UIStackView which can be displayed, how I can make the UIStackView scroll? 回答1: 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 (for vertical scrolling): Create a UIScrollView , and set its constraints. Add a UIStackView to the UIScrollView Set the constraints: Leading , Trailing , Top & Bottom should be

Expanding UITextView inside a Stack View with scrolling enabled

落花浮王杯 提交于 2019-12-25 12:38:08
问题 I am trying to achieve something with Auto Layout and Stackview. I have a Vertical Stackview with a UIView, UITextView, and UIView in it as shown below. I have checked out the previous answers here but couldn't find a clean solution to achieve this. The UITextView is editable and must expand as the user types in it - for this I have disabled the scroll for the UITextView in the IB. I also have a height constraint set on the UITextView set to "Greater than or equal to" 10 and number of lines

How to programmatically animate the alignment property of an UIStackView in ios 9

跟風遠走 提交于 2019-12-25 05:13:55
问题 I want to know how can I animate a change in the alignment property of an horizontal UIStackView say from UIStackViewAlignmentCenter to UIStackViewAlignmentTop and vice versa, and I want to visually reflects this change at the same time. EDIT: What I have: This is my hierarchy of views: two buttons named b1 and b2; b1 has an action named "changeAlignmentToTop" and b2 has an action named "changeAlignmentToCenter", which are activated Upon touch Up Inside in the respective button. an UIView

UIStackView properties according to size classes

妖精的绣舞 提交于 2019-12-25 04:42:47
问题 I try to test the UIStackView in a storyboard where I change the property "Axis" based on the orientation of an iPhone (wAny/hC, wC/hR). Unfortunately, at running, the change is not applied. Specifically, the property "Axis" is modified (inspected in Xcode), but the layout will not change. Thank you in advance for your help. 回答1: This is definitely a bug. The behavior of the axis at runtime (simulator or device), after closer inspection, only changes for every other UIStackView in the view