autolayout

Xcode how to make flexible constraint in Autolayout

蹲街弑〆低调 提交于 2019-12-23 06:23:43
问题 hello everyone I've get stuck in Auto-layout issues I have login storyboard that contains three Items Image-view , Stack-view , Button like the first image below I've tried to add constraints using two ways: The first way I've added "pinned" constraint to Image-view as shown in Photo1 below but when I've changed to landscape the Image was disappeared as the second photo below. please notice I haven't got any warnings The second Way I've tried by wrap the Image-view using view then i added

How to use constraints Programmatically? [closed]

时光总嘲笑我的痴心妄想 提交于 2019-12-23 06:12:14
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I am working on application which will work only horizontally and doing everything programmatically. I am having a imageview, two textfield and two buttons but I don't know how to set constraints on these textfields and buttons, means when I am using in iPhone 5s then it is fine

Line up three UILabels next to each other and each label can be multiline

一曲冷凌霜 提交于 2019-12-23 04:52:10
问题 I'am working on a project where I need to line up 3 UILabels next to each other. Let me explain it with an example. I have for example the following sentence. "Tim Moore commented on the little bear story" Now my three UILabels going to contain: LABEL 1 --> Tim Moore LABEL 2 --> commented on LABEL 3 --> the little bear story another example: Dave Smits likes the status "We and only we can me a knew future and only we nobody else can make changes, so don't stop now !" LABEL 1 --> Dave Smits

Animation with constraints in UITableViewCell launches incorrectly

↘锁芯ラ 提交于 2019-12-23 02:52:27
问题 I am running into an issue where I animate the size of a simple UIView in a table cell by adjusting an autolayout constraint. When I launch the table for the first time, everything is broken. If I reload the table, it works beautifully. It's a single view controller with only a few lines of code. Please download this demo project to see it in action. Here's my code in my whole UIViewController: import UIKit class TableCell: UITableViewCell { @IBOutlet weak var constraintRedBarWidth:

How to update constraint programmatically?

五迷三道 提交于 2019-12-23 02:36:41
问题 I want to update constraint programmatically in code. I have added them in storyboard controller. I make IBOutlet for the constraint and connect them. I add values in updateViewConstrains() but it isn't working: func updateViewConstraints() { centerYConstraint.constant = 60 super.updateViewConstraints() } 回答1: create an IBOutlet in your viewController.h file : @property (weak, nonatomic) IBOutlet NSLayoutConstraint *nameButtonVerticalConstraint; now connect it with the concerned autolayout

How to change textview height constraint within table view cell?

感情迁移 提交于 2019-12-23 01:58:06
问题 There's been a lot of questions about how to make dynamic cell height using Autolayout and TextView inside it. Here's the story I follow this article iOS dynamic table view cells with varying row height and Autolayout. In this case, we replace the 2nd label in the article with a TextView, with the same set of constraints The TextView does not have intrinsic content size as the Label. So we must use sizeThatFits and creating height constraint on the TextView, like this. This height constraint

UITableView inside UITableViewCell with dynamic height

╄→尐↘猪︶ㄣ 提交于 2019-12-23 01:07:39
问题 I need to put UITableView inside UITableViewCell with auto-layout because second table has different number of rows and one row can have different height. This is my ViewController class ViewController: UIViewController { let tableView = UITableView() let cellId = "firstTableCellId" override func viewDidLoad() { super.viewDidLoad() setupView() tableView.reloadData() view.backgroundColor = UIColor.gray } func setupView() { tableView.delegate = self tableView.dataSource = self tableView

How to tell UITableView that a self-sizing cell's height is about to change?

安稳与你 提交于 2019-12-23 01:03:33
问题 I've got a UITableView whose contents are somewhat dynamic. It seems like every time I resize them, I hit this error: 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

Google Maps Info window's resizing based on the internal content

心不动则不痛 提交于 2019-12-22 22:39:52
问题 I'm creating custom Info Window using this method - (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker based on the UIStoryboard using Autolayout. I expect that some of the internal views will be resized due to the actual text information will be received and the final size of the Info Window will be different from the view of IB. Actually, as the result my InfoWindow view tries to be full screen sized, and nothing helps to fix this. Playing with autoresizingMask

Updating existing constraints does not work, wrong use of .active property?

风流意气都作罢 提交于 2019-12-22 18:48:21
问题 I have a storyboard that contains : A "tab bar" on the left with 5 tabs A container on the right side of the tab bar that contains 6 image views that share the same space so it looks like this : Each image view is configured to occupy 1/3 of the container's width and 1/2 of its height. However, different ratios can be provided at runtime (from a JSON file) so that for example, the 1st image view's height become 70% of its container's height and 50% of its width (therefore, the 2nd and 3rd