autolayout

AutoLayout Understanding Multiplier

♀尐吖头ヾ 提交于 2020-01-03 07:29:06
问题 I have a problem with multiplier and cannot understand how this feature works. For example i have view has 6:1 multiplier(To SuperView.Leading) as below. When i change the multiplier to 2:1 it seems like below picture. My question is in the 6:1 relation what does 6 and 1 mean. And also in 2:1 relation what does 2 and 1 mean. Similar consider you have three view like the picture below. Totally there 4 blank areas between subViews and superView. How can i say every blank area must be the

Autolayout and Constraints for iPad

时光毁灭记忆、已成空白 提交于 2020-01-03 05:51:04
问题 I'm quite confused about the new auto layout feature of xCode 4.5. Here is I want to do, By setting the storyboard, I have this portrait view set up. By using autolayout and constraints(and pins), how can I transform the layout when its flipped to landscape like this? I tried coding and changing the CGRect(size and coordinate location) of the views when its landscaped but to no avail. 回答1: NSLayoutConstraints replace the need for CGRects in Auto Layout. First, describe your layout in words.

Is calling updateViewConstraints manually a good idea?

橙三吉。 提交于 2020-01-02 23:13:58
问题 I'm creating my constraints mainly in viewDidLoad . In updateViewConstraints I'm adding or removing some subviews and additionally adding and removing constraints. As a side note I'm using a container with child view controllers and I'm reusing the same view for different orientations (full in landscape, in a popover in portrait). Because I have my complete setup in updateViewConstraints I have to call it in some situations manually to adapt the visual changes and not to brake the constraints

How to create equal spacing between multiple label in ios xcode 6.3 using AutoLayout Constraints

两盒软妹~` 提交于 2020-01-02 09:27:14
问题 How can I implement auto layout for multiple label as shown in image I need to maintain relative equal spacing between all label and side space too. I want to maintain equal spacing between label 1,2,3,4. I am unable to maintain relative equal spacing between the labels for multiple iPhone versions using AutoLayout. I was able to solve using following steps: Step1: Place the label or button you want to create inside a view and give that view constraint as below: Step2: Select all the label or

Why does my UITableView's formatting go completely awry when I return from a view controller I segued to?

时光总嘲笑我的痴心妄想 提交于 2020-01-02 08:13:08
问题 I have a UITableView with a custom cell, which has a few labels in it that dynamically decide the height of the cell. When I tap on one cell and segue to a new view controller, upon returning all the formatting for the cells is completely messed up, and I can't figure out what is causing it. Here is what the cells normally look like: And I have some pretty basic constraints set on them. The top label is pinned to the top and left margins, and must always be >= 20 from the right. The other

Changing an Autolayout-constrained UIView's frame at runtime in Swift

萝らか妹 提交于 2020-01-02 07:02:11
问题 For example, I use this code to change the frame position of a UIView called Propo : self.Propo.frame.origin.x -= self.view.frame.width ( Propo has constraints in Storyboard) But When the app view disappears and reappears, the UIView resets itself to its original position. How can I do to resolve it? I want the UIView to keep its position when I change it programmatically. I've tried updateViewConstraints() by anything else append... 回答1: Constraints and manual frame manipulation are directly

iOS auto layout: how to dynamically evenly space items?

六月ゝ 毕业季﹏ 提交于 2020-01-02 05:40:07
问题 I need to evenly space X items, and the container for the items can have dynamic width, and I want the first and last items to stick to left and right edge: |-0-[item1]-[...]-[itemX]-0-| so that no matter how wide the container is, the items are always evenly spaced, how to implement this with layout constraints? edit: I was thinking that if I can set item1 and item2 to have same spacing as item2 and item3 and so on, then this should be easy, but I don't think I can set it without a constant

Dynamic TableView Cell Heights Incorrect Until After Scrolling (iOS 8) - full screenshots attached

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 05:36:09
问题 EDIT Built a new sample project from scratch and the dynamic tableview cell height is working flawlessly. I then tried to replicate by trimming down my project to it's bare minimum and it's STILL broken (first few cells buggy). Attaching full project for both working and not working examples. Project/code literally looks 99% identical and for the love of me can't figure out where the 1% difference is. The only thing that is popping out at me is that I used different size classes (wAny hAny vs

Auto Layout UILabels

纵饮孤独 提交于 2020-01-02 04:55:12
问题 I have three UILabels in my custom UITableViewCell . It might be that some UILabels will be empty ( label.text == @"" ) - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"EventCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; NSString *key = [[keysArray objectAtIndex:indexPath.section] description]; UILabel *nameLabel = (UILabel *)[cell viewWithTag:100];

How to adjust super view 's height base on subview's size in XIB?

和自甴很熟 提交于 2020-01-02 03:48:21
问题 In xcode 6 ,i create a xib for a custom view (named: ViewA,got a RED background color) ,and ViewA's xib got a file size 600*600, in ViewA ,I put a subview labelB (got a GREEN background color )in it ,and labelB's numberOfLines = 0 ,so labelB'height is variable , I want the ViewA 's height changed based on labelB's height (e.g ViewA.bottom = labelB.bottom + 10), and I have already pin the labelB's top,bottom,trailing,leading to ViewA, but it still doesn't !work ,the ViewA's height is always