autolayout

AutoLayout row height miscalculating for NSAttributedString

此生再无相见时 提交于 2019-12-20 09:05:19
问题 My app pulls HTML from an API, converts it into a NSAttributedString (in order to allow for tappable links) and writes it to a row in an AutoLayout table. Trouble is, any time I invoke this type of cell, the height is miscalculated and the content is cut off. I have tried different implementations of row height calculations, none of which work correctly. How can I accurately, and dynamically, calculate the height of one of these rows, while still maintaining the ability to tap HTML links?

What do “Use standard value” and “Constrain to Margins” mean in Auto Layout?

血红的双手。 提交于 2019-12-20 09:02:55
问题 I have gone through a couple of Auto Layout tutorials such as this. However I am still not clear on what the following options do in the pin dialog What are the differences between standard value, manual values, and canvas values? What does the constrain to margin checkbox do? What does align do? 回答1: What are the differences between standard value, manual values, and canvas values? Standard value uses "the recommended spacing for constraints that specify distance between items", which is

Inequality Constraint Ambiguity

眉间皱痕 提交于 2019-12-20 08:41:14
问题 i've a problem in resizing a UIView with Autolayout and constraints. I'd like to change the origin (less than or equal of original) and the width (greater than or equal of original) but I got this: Inequality Constraint Ambiguity Do you have idea for solve this? thanks 回答1: I tried to make more than 1 vertical spacing constraint shrink for 3.5" displays, so I had to make 2 constraints between components that I wanted to shrink on smaller screen. One constraint was inequality (greater or equal

iOS create NSLayoutConstraint programmatically for table view cell content

雨燕双飞 提交于 2019-12-20 08:26:42
问题 I want to add in the cellForRowAtIndexPath some views to my cell content view and for them constraints but nothing works. I have something like this: NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:imageView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:cell.contentView attribute:NSLayoutAttributeLeft multiplier:1.0f constant:10.0f]; [cell.contentView addConstraint:constraint]; How should I do this? 回答1: A couple of observations: Your creation

View height constraints are not set correctly as I scroll UICollectionView up and down

懵懂的女人 提交于 2019-12-20 05:49:13
问题 I'm trying to decide view heights based on a model property, but as UICollectionView is scrolled up and down, incorrect heights are assigned to visible cells. It seems that setting a HeightAnchor in GetCell (i.e. cellForItemAtIndexPath ) does not work. How can I make this work? using CoreGraphics; using Foundation; using System; using System.Collections.Generic; using UIKit; namespace App2 { public partial class ViewController : UIViewController { private UICollectionView _collectionView;

Constraints not updating with device orientation change

无人久伴 提交于 2019-12-20 05:14:22
问题 I have a color slider in a tableView cell that extends from the label to the trailingAnchor of the cell. The issue I am having is when the device orientation changes the color slider does not update its constraints and no longer extends the full length of the cell. Below is my code to set up the constraints on the color slider. Below are images to show the issue I am having. If my phone is already in landscape orientation when I present this scene the color slider extends the full length of

Group TableView,using self sizing section header,after reload,if I scroll upward ,tableview will jump

馋奶兔 提交于 2019-12-20 05:02:36
问题 I am doing a tableview like this: a twitter and comments on it; enter image description here I have tried several architecture.I do not find enough question and discussion about this. I think it is a very meaningful question,so I post these architectures' performance and limitations. First,using whole cell as twitter with comments,which comments view will generate according to the model.Cell use self-sizing auto-layout height. This architecture can work.But if a twitter have many comments(30

iOS Use Vary For Traits Between iPhone Sizes

主宰稳场 提交于 2019-12-20 04:27:18
问题 I have a button that I want to be different widths depending on which kind of iPhone is being used. Obviously a larger width for the 7 Plus, and smaller on down the line. I click the button, click Vary for Traits, choose Height, change constraints for each iPhone, then click Done Varying and build, but it always keeps whatever the last constraint I edited was, no matter which device I run it on. 回答1: Vary For Traits has nothing to do with different iPhone sizes. All iPhones (in portrait) have

iOS AutoLayout issue with ScrollView

怎甘沉沦 提交于 2019-12-20 03:26:21
问题 Hello i have an auto layout issue with UIScrollView and ModalViewController . Here are my coding steps as sample code: 1) I have an UIViewController with an UIScrollView as subView UIViewController *viewController = [[UIViewController alloc] init]; UIScrollView *scrollView = [[UIScrollView alloc] init]; scrollView.translatesAutoresizingMaskIntoConstraints = NO; [viewController.view addSubview:scrollView]; UIView *superView = viewController.view; NSDictionary *viewsDict =

Main.Storyboard Frames Not Updated

混江龙づ霸主 提交于 2019-12-20 02:29:15
问题 I am currently making an app which I plan to submit to the iOS App Store. Normally, when I update my frames in the Main.Storyboard of Xcode, it stays like that. However, now it does not. Whenever I close the app and reopen it later, the frames are not updated. It looks like this: After I update the frames, it looks like this (what I want it to look like): The app still looks fine when I run it on the simulator, but I still have 16 warnings in my app. I would like to remove these bugs as (I