autolayout

How can I get autolayout to override a UIImageView's intrinsic size?

纵然是瞬间 提交于 2020-06-10 02:21:28
问题 I'm running into a problem with the autolayout for my detail view in a UISplitViewController . My view hierarchy contains a UIImageView with a decorative element, and the image view's intrinsic size seems to be screwing up the layout of the rest of the controls. These are the constraints I have specified for the image view: H:[UIImageView:0xc83ba90]-(NSSpace(20))-| H:|-(NSSpace(20))-[UIImageView:0xc83ba90] UIImageView:0xc83ba90.bottom == UITextField:0xc83d2d0.bottom V:[UIImageView:0xc83ba90

Wrap items in a horizontal UIStackView on multiple lines

大城市里の小女人 提交于 2020-05-24 05:07:31
问题 I am working on an iOS app which display a UITableView of items. Each row will show a list of tags with different widths(given by the tag's text length). I can place all the tags in a horizontal UIStackView but I want them to wrap on multiple lines instead of o a single scrollable one. Basically I'm interested in a functionality similar to FlexBox's flex-wrap property. I've attached an image for reference. Any ideas how to achieve this? 回答1: There are a number of different ways to approach

UILabel word wrap feature leaving space even when sufficient space available for the word

元气小坏坏 提交于 2020-05-24 05:07:16
问题 The problem coming even in storyboard. The UILabel is having following properties: numberOfLines = 0 lineBreakMode = .byWordWrapping Constraints: Leading & Trailing 26 points to superview; vertically center. Custom Font: Medium 17 Points. As you can see the fourth word cannot fit in the first line and hence a problem by creating bad layout. If I remove the last word the sentence fits in one line completely or say the fourth word. If adding a word after it moves both of them to next line which

Wrap items in a horizontal UIStackView on multiple lines

六月ゝ 毕业季﹏ 提交于 2020-05-24 05:07:10
问题 I am working on an iOS app which display a UITableView of items. Each row will show a list of tags with different widths(given by the tag's text length). I can place all the tags in a horizontal UIStackView but I want them to wrap on multiple lines instead of o a single scrollable one. Basically I'm interested in a functionality similar to FlexBox's flex-wrap property. I've attached an image for reference. Any ideas how to achieve this? 回答1: There are a number of different ways to approach

UIScrollView ContentView dynamic height constraints

岁酱吖の 提交于 2020-05-13 01:21:49
问题 I am facing issue with contentView height constraints. All labels have dynamic height i.e no fixed height. I have read somewhere to set height equal to scrollview height. The height of ViewController is currently 870px, scrollview height is 757px. I have no idea how can i set height in AutoLayout , as I am unable to scroll after a certain point. I have set UIScrollView first then I added UIView as the child of the UIScrollView then I added 2 UIImageView and few UILabels, the size of UILabel

UIScrollView ContentView dynamic height constraints

蓝咒 提交于 2020-05-13 01:20:06
问题 I am facing issue with contentView height constraints. All labels have dynamic height i.e no fixed height. I have read somewhere to set height equal to scrollview height. The height of ViewController is currently 870px, scrollview height is 757px. I have no idea how can i set height in AutoLayout , as I am unable to scroll after a certain point. I have set UIScrollView first then I added UIView as the child of the UIScrollView then I added 2 UIImageView and few UILabels, the size of UILabel

Center UIView vertically in scroll view when its dynamic Labels are small enough, but align it to the top once they are not

谁都会走 提交于 2020-05-09 18:53:10
问题 I have a view with 3 dynamic labels inside it and I am trying to find a way to centre it vertically in a scroll view but when its dynamic labels are too large to fit on a page, make the text start from the top. What Xcode is doing at the moment is this: What I am trying to do is this: Any ideas about how to achieve this? Thanks. 回答1: You can accomplish this by embedding the labels in a stack view and embedding the stack view in a UIView. The label text will expand the stack view vertically,

Swift开发:仿Clear手势操作(拖拽、划动、捏合)UITableView

大兔子大兔子 提交于 2020-04-17 03:32:26
【推荐阅读】微服务还能火多久?>>> 这是一个完全依靠手势的操作ToDoList的演示,功能上左划删除,右划完成任务,拖拽调整顺序,捏合张开插入。 项目源码: https://github.com/luan-ma/ClearStyleDemo.Swift 初始化 TDCToDoItem.swift 定义模型对象 TDCToDoListController.swift 继承自 UITableViewController, 演示UITableView操作 var items = [ TDCToDoItem(text: "Feed the cat"), TDCToDoItem(text: "Buy eggs"), TDCToDoItem(text: "Pack bags for WWDC"), TDCToDoItem(text: "Rule the web"), TDCToDoItem(text: "Buy a new iPhone"), TDCToDoItem(text: "Find missing socks"), TDCToDoItem(text: "Write a new tutorial"), TDCToDoItem(text: "Master Objective-C"), TDCToDoItem(text: "Remember your wedding anniversary

IOS8 Autolayout with relative width / height

不羁的心 提交于 2020-04-11 05:09:11
问题 I need to autolayout a storyboard UIView with a single UIControl. The UIControl should be centered, needs to have a aspect ratio of 1:1 and should always use 90% of the superviews width or height depending on the device orientation without clipping. I added 4 constraints Center Y Alignment - View - Superview Center X Alignment - View - Superview Equal Widths - View - Superview with multiplier set to 0.9 Aspect Ratio - View - View with multiplier set to 1:1 This setup works fine in portrait

Searchbar behind Navigationbar

徘徊边缘 提交于 2020-03-25 19:00:30
问题 Given 3 Controllers: A,B,C A has a hidden navigationbar. Calls Controller B via a StoryboardReference. Controller B shows Navigationbar on viewDidLoad. It has a searchbar and a collectionView. See screenshot A of my storyboard. Calls controller C if a cell is clicked. Problem: If A calls B the searchbar is behind the navigationbar (Screenshot B). It appears with the transition from C to B (Screenshot C). Navigationbar is already translucent. Any ideas? EDIT I realized that my animated