autolayout

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

Top space on device rotation

荒凉一梦 提交于 2019-12-24 07:59:37
问题 I have the following constraints on my UIView in portrait mode: And landscape: This is screenshot of the ViewController when I open it first time: Top space is OK. Then I'm rotating the device to landscape: Do you see that white space on the top? And when I'm rotating it back to landscape, the space still stays: Why and how to fix it? 回答1: Try to uncheck Adjust scrollview insets Of viewcontroller attribute Source Of Image: Here 回答2: You might have set TopConstraint of your view With margin.

“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

Auto Layout how to move the view2 from right to the bottom?

南楼画角 提交于 2019-12-24 07:39:52
问题 I have two views in the cell at the left UIImageView and at the right UIView Containing some other views as in picture Now I want if the width of Cell is => 300 then View2 should be at the right of Screen as it is in picture other wise it should be moved to the bottom of View1 回答1: Do one thing. Set another constraints for that view 1) leading to main view 2) top to imageview (you can give this constraint by right click from view to drag imageview then vertical spacing.) Now give outlets for

Custom UITableViewCell height changes when moved

你说的曾经没有我的故事 提交于 2019-12-24 07:25:13
问题 I am using Autolayout and estimatedHeightForRowAt to dynamically change cell height. This is the code I am using: var heightAtIndexPath = NSMutableDictionary() func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { let height = self.heightAtIndexPath.object(forKey: indexPath) if ((height) != nil) { return CGFloat(height as! CGFloat) } else { return UITableViewAutomaticDimension } } func tableView(_ tableView: UITableView, willDisplay cell:

Basic UIAlertController Unable to satisfy constraints

 ̄綄美尐妖づ 提交于 2019-12-24 06:37:13
问题 UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; [alertController show]; This code is causing the following error: ...[LayoutConstraints] 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

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.

Manage UITextField's dynamic position using auto layout

 ̄綄美尐妖づ 提交于 2019-12-24 05:47:06
问题 My client’s requirement is as follows: I am going to create registration form with around 15 textFields(Pre defined on server). Information of fields in registration fields are coming from server. There are chances that some fields are not required in some cases. So, I will get fields which are required for that particular case. E.g. Suppose No. of predefined fields are 15 on server. i.e. FirstName, LastName, Phone no., Date of Birth, Picture, Email,Address,zipcode etc. But there are chances

Xcode storyboard constraints and auto layout

做~自己de王妃 提交于 2019-12-24 05:45:36
问题 I'm working on an app at the moment and one thing that I've been struggling with for the past two weeks has been auto layout. I'm new to iOS programming so I'm not exactly sure the best way to explain my problem but here goes. I'm making a piano app and the way it works is that my keyboard is just a bunch of buttons laid out next to each other. These buttons represent the keys. The buttons have a background image of an image of a regular piano key. Now my problem is that I have a black above

How do I prepare a UIViewController's view for being added to a UIStackView?

久未见 提交于 2019-12-24 05:38:11
问题 This is what I'm trying to do... I have one view controller that needs to dynamically display different subviews based on the presence of some data. Here is a simple mockup. Each colored block represents a unique subview . Sometimes the green block needs to be at the top, sometimes the green block won't display at all, sometimes the light blue block will be something different, etc. Each subview has interactive elements, so I've been creating and adding them like so: Defining a new view