autolayout

Is it okay to mix autoresizing mask with autolayout?

时光总嘲笑我的痴心妄想 提交于 2020-01-13 20:42:11
问题 I believe using autoresizing for orientational changes would be good while managing the UI with Autolayout. So many programmers are recommending against both at the same time,But As far as I understand it should be fine. Because Autoresizingmask is easy to play with. I think autoresizing mask itself turns into constraints actually I believe translatesAutoresizingMaskIntoConstraints Correct me If I am wrong If its okay or not okay can some explain in depth why ? 回答1: As far as I am aware it is

UICollectionView inside of UITableViewCell - AutoLayout

守給你的承諾、 提交于 2020-01-13 19:27:09
问题 I'm using a UICollectionView inside of a UITableViewCell . It's all working fine, but i have some issues with Auto Layout. The UICollectionView should just show the cells without horizontal or vertical scrolling.Because now I have a the scrollable UICollectionView inside my UITableViewCell the following code doesn't work for me to get the dynamic table cells' height for this cell, but for other cells. self.tableView.rowHeight = UITableViewAutomaticDimension self.tableView.estimatedRowHeight =

Auto layout of custom programmatic UITableViewCell fails upon scrolling

徘徊边缘 提交于 2020-01-13 18:30:25
问题 I'm trying to use the new auto layout capability of iOS 6 on a custom UITableViewCell which has been implemented programmatically. I added the addConstraint calls, and it works properly at first-- until I scroll. When I come back to the cell after scrolling the layout is trashed. By trashed I mean the margins between fields are all wrong (too large, well beyond the size of the cell). I'm speculating this has something to do with the dequeueReusableCellWithIdentifier method leaving me with a

Using auto-layout in a custom view where constraints rely on frame

青春壹個敷衍的年華 提交于 2020-01-13 09:01:56
问题 I'm writing a custom view that is initialized programmatically. I override updateConstraints to add all the constraints required for this view. : - (void)updateConstraints { [self.superview addConstraint:[NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.superview attribute:NSLayoutAttributeCenterX multiplier:1 constant:0]]; [self.superview addConstraint:[NSLayoutConstraint constraintWithItem:self attribute

Correct way to programmatically update constraints when the device orientation changes?

我怕爱的太早我们不能终老 提交于 2020-01-13 09:01:26
问题 I'm using storyboard and autolayout , and setting the constraints in IB as IBOutlet in the corresponding view controller. I'm reading several posts regarding how to update the constraints to be different in portrait and in landscape but I'm still not sure of how should I do this: Should I set the new constraints in -viewWillTransitionToSize:withTransitionCoordinator: method, or in updateViewConstraints method? When the new constraints are set, should I call [self.view

When I use Auto Layout to choose each cell's height (so they're dynamic) it mostly works, but some cells are a little short. Why is this?

拜拜、爱过 提交于 2020-01-12 09:21:30
问题 Example project: http://cl.ly/2j0A1J203f3h I'm trying to use Auto Layout to dynamically determine each cell's height so some cell's can hold more content than others. To do this I'm using this Stackoverflow answer and the accompanying GitHub example. I have a UITableViewCell subclass called CSPostCell that I created in the Storyboard and put a UILabel in with a maximum of 5 lines of text in the label. Just for example purposes, I'm only having two cells in the table and as such two different

When I use Auto Layout to choose each cell's height (so they're dynamic) it mostly works, but some cells are a little short. Why is this?

人盡茶涼 提交于 2020-01-12 09:21:25
问题 Example project: http://cl.ly/2j0A1J203f3h I'm trying to use Auto Layout to dynamically determine each cell's height so some cell's can hold more content than others. To do this I'm using this Stackoverflow answer and the accompanying GitHub example. I have a UITableViewCell subclass called CSPostCell that I created in the Storyboard and put a UILabel in with a maximum of 5 lines of text in the label. Just for example purposes, I'm only having two cells in the table and as such two different

In autolayout, how can I have view take up half of the screen, regardless of orientation?

我们两清 提交于 2020-01-11 15:46:33
问题 In portrait mode, I have a tableview on the left-side, and a webview on the right-side. They both take half of the screen. I have autolayout enabled. But when I rotate the screen to landscape mode, the tableview's width takes up less than half the screen's size, and the webview ends up taking more, instead of them being an even split. Why does this happen? How can I have the views take up only half the screen in regard to their widths, regardless of screen orientation? 回答1: The first half of

Automatically grow document view of NSScrollView using auto layout?

随声附和 提交于 2020-01-11 15:39:08
问题 Is there a simple way to get an NSScrollView to adapt to its document view changing size when using auto layout? I have tried to call both setNeedsUpdateConstraints: and setNeedsLayout: on the document view, the clip view and the scroll view, without any results. fittingSize of the document view reports the correct size. The problem is that the document view, which holds subviews, is not re-sized when the subviews change their size, even if they call invalidateIntrinsicContentSize . The

How to create storyboard layout multiple views within header view iOS?

点点圈 提交于 2020-01-11 12:34:28
问题 I have created header UIView on storyboard view controller, now I need to create 4 views like below colored image Into that UIview base view. It should show for all devices. Need to adjust auto layout using iOS . 回答1: First set constraints to header view. Select header view and apply following constraints: Leading, top, trailing space and Height = 80 (for example) Once you apply constraints to header view then select all buttons at once : Hope this can help 回答2: Try this.. Now IOS 9 realse