nslayoutconstraint

Unable to simultaneously satisfy constraints - No constraints in place

北城以北 提交于 2019-11-26 23:58:16
I have gone through and removed every single user constraint yet I am still getting the following error ONLY after I rotate the device. I have absolutely no clue why though. Does anyone have any ideas? 2013-01-14 21:30:31.363 myApp[35869:c07] 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

NSLayoutConstraint crashes ViewController [duplicate]

有些话、适合烂在心里 提交于 2019-11-26 23:56:55
问题 Possible Duplicate: presentViewController: crash on iOS 6 (AutoLayout) I'm getting this error when clicking on a button in my app: 2012-06-28 21:43:36.860 AppName[2403:707] *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint' *** First throw call stack: (0x3568788f 0x37a2e259 0x35687789 0x356877ab 0x333a254d 0x333a26bb 0x333a2423 0x33333001 0x332a13c7 0x3317ec59 0x330f4c17 0x330ff267 0x330ff1d5

Autolayout: Add constraint to superview and not Top Layout Guide?

给你一囗甜甜゛ 提交于 2019-11-26 23:54:21
I have a UIView in my UIViewController in storyboard which I want to add a constraint on to space that view a distance from the top edge. Now, when I do the usual by ctrl + drag to the ViewController's main view I only get option to set it to top layout guide. This is a problem for me because at one point in the app Im going to move the main view up around 20-50px and what happens then is that view I have will not move... because its not aligned to superview. How can I manually do this in storyboard or do I have to add it programatically? Im using xcode 6. There is an arrow to the right of the

iOS change auto layout constraints when device rotates

。_饼干妹妹 提交于 2019-11-26 23:50:31
问题 I want to modify the layout constraints when the device rotates. My UIViewController is composed of 2 UIViews , in landscape they are horizontally aligned, and in portrait they are vertically aligned. It does work actually, in willAnimateRotationToInterfaceOrientation , I remove the desired constraints and replaced them with others to have the right layout... But there are problems, during rotation auto layout starts breaking constraints before willAnimateRotationToInterfaceOrientation is

UITableView within UIScrollView using autolayout

蹲街弑〆低调 提交于 2019-11-26 23:21:25
At the moment, I'm using a UITableView along with other views that are contained in a UIScrollView . I want the UITableView to have its height to be the same as its content height. To complicate things, I'm also inserting / deleting rows to provide an accordion effect so that when the user taps on a row, it will show more detail for that row. I've got the insert / deletion done, though at the moment it doesn't update the UIScrollView which is its superview so that the content size of the UIScrollView is recalculated and the UITableView along with other views in the UIScrollView are displayed

UIScrollView with iOS Auto Layout Constraints: Wrong size for subviews

会有一股神秘感。 提交于 2019-11-26 22:59:12
问题 I'm trying to generate a view in code. Here's the hierachy of my view object UIScrollView UIView UIButton The ScrollView should be the same size as the window. The button should be as big as possible. I'm using iOS auto layout, so the constraint strings for all of my objects look like this H:|[object]| V:|[object]| I've also set translatesAutoresizingMaskIntoConstraints to NO for each object. The problem is that the button only gets the default button-size. Its parent view object (UIView)

UICollectionView autosize height

拟墨画扇 提交于 2019-11-26 22:30:36
问题 How do I properly resize a UICollectionView so that it fully displays its contents? I have tried many things, including setting its frame, calling reloadData and invalidating the layout: self.collectionView.contentSize = CGSizeMake(300, 2000); self.collectionView.frame = CGRectMake(0, 0, 300, 2000); [self.collectionView reloadData]; [self.collectionView.collectionViewLayout invalidateLayout]; but none of this has any effect. After pressing the button I still see the initial view, like this: I

setNeedsLayout vs. setNeedsUpdateConstraints and layoutIfNeeded vs updateConstraintsIfNeeded

扶醉桌前 提交于 2019-11-26 21:12:30
I know that the auto layout chain consists in basically 3 different process. updating constraints layout views (here is where we get calculation of frames) display What's is not totally clear to me is the inner difference between -setNeedsLayout and -setNeedsUpdateConstraints . From Apple Docs: setNeedsLayout Call this method on your application’s main thread when you want to adjust the layout of a view’s subviews. This method makes a note of the request and returns immediately. Because this method does not force an immediate update, but instead waits for the next update cycle, you can use it

How to update the constant height constraint of a UIView programmatically?

有些话、适合烂在心里 提交于 2019-11-26 19:48:26
I have a UIView and I set the constraints using Xcode Interface Builder. Now I need to update that UIView's height constant programmatically. There is a function that goes like myUIView.updateConstraints() , but I don't know how to use it. Select the height constraint from the Interface builder and take an outlet of it. So, when you want to change the height of the view you can use the below code. yourHeightConstraintOutlet.constant = someValue yourView.layoutIfNeeded() Method updateConstraints() is an instance method of UIView . It is helpful when you are setting the constraints

AutoLayout to keep view sizes proportional

强颜欢笑 提交于 2019-11-26 19:33:38
问题 I'm trying to achieve the following: I have 2 views in my xib that need to stay 20 pixels off the edge (both sides and top) The 2 views that need to resize aren't the same size They have to be 20 pixels apart Their width needs to stay relative to the width of the parent view I read a tutorial about doing just that and it works but the problem with it is that it requires both views to have the same width and pin Widths equally , which I don't want. Here's what I tried: Add leading space