autolayout

Auto Layout Constraint With Dynamic Variable?

一曲冷凌霜 提交于 2019-12-21 05:37:13
问题 Is it possible to have an Auto Layout constraint ( NSLayoutConstraint ) with a dynamic constant/multiplier? For example, this would be a bog standard NSLayoutConstraint : NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:obj1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:obj2 attribute:NSLayoutAttributeLeft multiplier:1 constant:0]; Then here would be an alteration of that constraint but a dynamic variable in the constant: NSLayoutConstraint

Auto-Layout Issues: iOS 7 vs iOS8

廉价感情. 提交于 2019-12-21 05:18:07
问题 I am trying to create a collapsible toolbar that works like this (running in iOS 7 -- ugly colors etc. for visualization purposes): However, when I run the code in iOS 8, this is what happens: I have set up a constraint system that is based on the following: A centering view (not shown) keeps the toolbar in the screen middle. A sizing view is adjusted to collapse the toolbar. The sizing view is anchored to the right of the centering view (via a trailing constraint). A container view holds the

cell.contentView systemLayoutSizeFittingSize: does not work for dynamic height tableview

廉价感情. 提交于 2019-12-21 04:57:14
问题 I tried to use autolayout in custom uitableviewcell And tried to implement the dynamic height according to this SO topic Using Auto Layout in UITableView for dynamic cell layouts & variable row heights But my cell is created by xib file. So the method is somewhat different Here is my code in heightForRowAtIndexPath -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { myDataItem *item= [[data items] objectAtIndex:[indexPath row]]; CustomCell *cell =

Gesture recognizers and auto-layout in iOS6, scaling from the center

删除回忆录丶 提交于 2019-12-21 04:29:32
问题 This gesture recognizer code below, which normally would scale a view from the center, does not when auto-layout is enabled in iOS6. The view seems to scale from it's origin when auto layout is enabled. Other affine transformations (particularly scale and rotate) are also not working as I expected. Anyone have this issue, or can enlighten me to the right way to handle this? - (IBAction)handlePinch:(UIPinchGestureRecognizer *)recognizer { recognizer.view.transform = CGAffineTransformScale

iOS 10 Messages Extension - Wrong Layout when using Storyboard Segue

こ雲淡風輕ζ 提交于 2019-12-21 04:20:51
问题 When using Segues in Messages Extension Application the layout gets messed up. Is there any way to solve this issue while still using storrybord segues? Screenshots: (Note: The first and second View / ViewController are identical. The segue-type doesn't matter) Expanded Presentation Style: Compact Presentation Style: Update 1: The top and bottom layout guides reset after a segue compact: top: should be: 0 but is: 20 bottom: should be: 44 but is: 0 expanded: top: should be: 86 but is: 20

Unable to change UIInputView height

自古美人都是妖i 提交于 2019-12-21 03:57:06
问题 I have a simple UIInputViewController subclass with only two overridden methods. I use this input view controller as inputAccessoryViewController on my UIViewController subclass which becomes first responder. I try to specify height of inputView by adding constraint as Apple documentation recommends. Problem is that my constraint doesn't work and I get autolayout exception when my constraint is being added Unable to simultaneously satisfy constraints. Probably at least one of the constraints

How to set a label's preferredMaxLayoutWidth to automatic programmatically?

白昼怎懂夜的黑 提交于 2019-12-21 03:42:44
问题 I get the following errors when I attempt to set a label's Preferred Width to Automatic in a storyboard: Attribute Unavailable: Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0 Since I need my layout to work on both iOS 7 and 8, I was planning to do the following: Set the value to Explicit in the storyboard. On iOS 7, set the value to an explicit, computed width programatically. On iOS 8, set the value to automatic programatically. 1 and 2 are easy. How do I

Handling AutoLayout constraint animation differences in iOS 10?

馋奶兔 提交于 2019-12-21 03:11:22
问题 I've noticed that in iOS 10 Beta 5 (about to try Beta 6), AutoLayout constraint animation behaves a bit differently. For example, this approach does not work the same as it did in previous iOS releases: [view addConstraints:@[constraints...]]; [view setNeedsUpdateConstraints]; [view layoutIfNeeded]; [UIView animateWithDuration:... { /* adjust constraint here... */ [view layoutIfNeeded]; // Only the adjusted constraints since previous layoutIfNeeded() call should animate change with duration.

Views are Horizontally and Vertically Ambiguous with complex layout

梦想与她 提交于 2019-12-21 02:41:35
问题 I have a UIViewController on my storyboard that has 2 subviews side-to-side horizontally. I added constraints to fix the leading and trailing edges to a constant (20 pts), and another constraint to keep the widths equal. If I assume the following, it should be possible to calculate what the width of each subview will need to be: the subviews do not overlap there are no other views present (horizontally, at least) the width of the screen (the superview) is known However, XCode gives me a

UICollectionView cells resizing when deleting items with estimatedItemSize

点点圈 提交于 2019-12-21 01:25:10
问题 I have a simple project with a storyboard containing only a single a UICollectionViewController , built with Xcode 7.1.1 for iOS 9.1 class ViewController: UICollectionViewController { var values = ["tortile", "jetty", "tisane", "glaucia", "formic", "agile", "eider", "rooter", "nowhence", "hydrus", "outdo", "godsend", "tinkler", "lipscomb", "hamlet", "unbreeched", "fischer", "beastings", "bravely", "bosky", "ridgefield", "sunfast", "karol", "loudmouth", "liam", "zunyite", "kneepad", "ashburn",