nslayoutconstraint

Aspect ratio NSLayoutConstraint in UITableViewCell is breaks

梦想的初衷 提交于 2019-12-24 20:42:32
问题 I'm trying to set appropriate NSLayoutConstraint s for a UIImageView in a UITableViewCell . The desired constraints are as follows: 16:9 aspect ratio 0 leading 0 trailing 11 top 11 bottom The UIImageView is the sole subview of the cell's contentView. I have set tableView.rowHeight = UITableViewAutomaticDimension and tableView.estimatedRowHeight = 80 2018-03-28 15:52:30.454688-0400 TestApp[28844:694668] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of

Constraints Not Updating When Keyboard Appears

╄→гoц情女王★ 提交于 2019-12-24 18:23:04
问题 I am making a sign up screen and would like to update a few top anchors so that when the keyboard appears, the top anchor constant decreases and the keyboard doesn't cover any text fields. I have created a topConstant variable: var constraintConstant: CGFloat = 35 And have set up my views as follows: view.addSubview(passwordTextField) passwordTextField.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 25).isActive = true passwordTextField.rightAnchor.constraint(equalTo: view

App crashing sometimes when transitioning between views: how to debug constraints?

瘦欲@ 提交于 2019-12-24 17:13:14
问题 I perform a transition between views with an animation. It sometimes works, and it also sometimes causes a crash and I don't understand why. I have my code within a @try-@catch block but no exception is retrieved in @catch . I simply get an app crash with a SIGABRT signal and the following log: 2015-09-23 10:03:43.420 My App[1510:528283] The view hierarchy is not prepared for the constraint: When added to a view, the constraint's items must be descendants of that view (or the view itself).

Setting cells height gives me error

ぐ巨炮叔叔 提交于 2019-12-24 12:35:03
问题 I have a UIView in a UITableViewCell . I'm trying to change the height of the view with an animation. Here is what I did: self.myViewConstraint.constant = 100; // Coming from 0 [UIView animateWithDuration:0.3f animations:^{ [self.view layoutIfNeeded]; }]; The only thing is, it's in a tableView . So here's what I did for the heightForRow... : return self.myViewConstraint.constant == 0 ? 74 : 174; Now I need to update the tableView , so I inserted in animateWithDuration : [self.tableView

Dynamic height using Auto Layout in Today Extension

烂漫一生 提交于 2019-12-24 08:01:00
问题 EDIT: My "original" problem has been solved, it was restricted to 110 height, by "<NSAutoresizingMaskLayoutConstraint:0x6000000985b0 h=--& v=--& UIView:0x7fc83af0aeb0.height == 110 (active)>" , but that was before I read about NCWidgetDisplayMode , .Compact and .Expanded , which apparently was introduced in iOS 10. Funny thing: Looks like they had the bug when they presented the new feature in iOS 10 (https://developer.apple.com/videos/play/wwdc2016/101/?time=3221) With that implemented

“Width equals height” constraint using visual format language

半腔热情 提交于 2019-12-24 07:46:30
问题 In order to add width equals to its superview height we can do following NSLayoutConstraint(item: view, attribute: .width, relatedBy: .equal, toItem: view.superview, attribute: .height, multiplier: 1, constant: 0) or we can do it from interface builder But how can I do the same using VFL? 回答1: From the documentation of Auto Layout Guide: Visual Format Language The notation prefers good visualization over completeness of expressibility. Most of the constraints that are useful in real user

Mysterious value introduced by NSAutoresizingMaskLayoutConstraint set by AutoLayout system

青春壹個敷衍的年華 提交于 2019-12-24 06:32:57
问题 AutoLayout is adding a NSAutoresizingMaskLayoutConstraint that causes a conflict, and it's unclear where and how. The question is: where does the height of 293 come from? UIView hierarchy: The AutoLayout log has been numbered. Xcode labels didn't show up in the AutoLayout logs. Line 1 seems to be the trouble. Based on the constraints, it seems this is Post View Cell , which is a custom UICollectionViewCell . Yet the sizeForItemAt UICollectionViewDelegate function does not return this value.

UIViewAlertForUnsatisfiableConstraints when presenting popover controller on iOS8 iPad

强颜欢笑 提交于 2019-12-24 03:16:47
问题 UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"What would you like to do?" message:@"" preferredStyle:UIAlertControllerStyleActionSheet]; [alert addAction:...] //left out for brevity of post UIPopoverPresentationController *pop = [alert popoverPresentationController]; pop.sourceView = self.view; pop.sourceRect = self.view.frame; pop.permittedArrowDirections = UIPopoverArrowDirectionAny; [self presentViewController:alert animated:true completion:^{ }]; The methods in

Xcode 6.3.2 - Can't enter negative values in Layout Builder constraints

北城余情 提交于 2019-12-23 16:42:11
问题 My Xcode version is 6.3.2 (6D2105). Whenever I try to enter a negative value for any constraint constant in the Layout Builder, the value turns to 0. Even if the value was already negative and I've just changed the number itself, the value becomes 0. Update: Still happens on 7.3 (7D175). Machine: El Capitan 10.11.4 (15E65), running on VMWare MacOS 10.8 host. 回答1: Uncheck "Constrain to margins" checkbox in the pin menu while adding spacing to nearest neighbour for the new constraints. 来源:

Swift NSLayoutConstraint Equation Based Constant

放肆的年华 提交于 2019-12-23 05:29:35
问题 I have been learning Swift programmatically, and in doing so building a camera (film) app. I am working on constraints, and it is pretty much straight forward. But what I would like to do now is implement aspect ratios; the user can cycle through standard film and TV aspect ratios that will determine the size of the view. As I am building a universal app, the constrains need to be based on the height of the view. So, I need a constant that is an equation and not a numerical value. Something