Comments (6)
👍
from orstackview.
In the case above, you're not setting the text for the second label, so it has no height.
AutoLayout isn't magic, you can't let a tableviewcell set it's height via AL, we use this pattern in the Artsy App, generate the height like the old days, then throw a stack view in there.
ORStackView *stackView = [[ORStackView alloc] init];
UILabel *labelOne = [[UILabel alloc] init];
labelOne.text = @"One";
labelOne.backgroundColor = [UIColor greenColor];
UILabel *labelTwo = [[UILabel alloc] init];
labelTwo.text = @"Two";
labelTwo.backgroundColor = [UIColor blueColor];
UILabel *labelThree = [[UILabel alloc] init];
labelThree.text = @"Three";
labelThree.backgroundColor = [UIColor greenColor];
[stackView addSubview:labelOne withTopMargin:@"10" sideMargin:@"20"];
[stackView addSubview:labelTwo withTopMargin:@"20" sideMargin:@"20"];
[stackView addSubview:labelThree withTopMargin:@"10" sideMargin:@"20"];
[self.contentView addSubview:stackView];
[stackView alignToView:self.contentView];
from orstackview.
Ha! That is an example of why not to copy and paste!
Thanks for that, I think the bit I was missing was the call to alignToView:.
from orstackview.
Well, I tried again with my actual code and hit the problem again. I've updated my example to be closer to my actual code. I've hardcoded the cell height in this example to what it should roughly be once 3 views have been added to the cell
from orstackview.
This also is an auto layout issue I think, those UIViews that the labels sit in don't have an intrinsic content size, see how they have 0 height?
from orstackview.
You're right. I need to invest in reveal....
Thanks
from orstackview.
Related Issues (16)
- Cocoapods does not find ORStackView HOT 2
- Create a horizontal ORStackView HOT 8
- Remove FLKAutoLayout HOT 1
- invertedSideMargin is broken when using less than or greater than. HOT 1
- Typo in ORStackScrollView HOT 1
- Crash on iOS8 HOT 1
- Layout in the example is not working in iOS 8 HOT 2
- Give an assert when passing an empty string HOT 2
- Change margin type from NSString * to CGFloat? HOT 2
- Release v3 HOT 6
- Make slather optional in podfile
- Support for UIWebView HOT 2
- Nested ORStackView with different orientation HOT 3
- Create a testing target and hook it up to travis HOT 2
- Create an ORStackViewController HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orstackview.