Giter Site home page Giter Site logo

Comments (6)

orta avatar orta commented on August 24, 2024 1

👍

from orstackview.

orta avatar orta commented on August 24, 2024

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.

screen shot 2014-05-07 at 09 37 52

    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.

foulkesjohn avatar foulkesjohn commented on August 24, 2024

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.

foulkesjohn avatar foulkesjohn commented on August 24, 2024

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.

orta avatar orta commented on August 24, 2024

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?

screen shot 2014-05-07 at 10 21 32

from orstackview.

foulkesjohn avatar foulkesjohn commented on August 24, 2024

You're right. I need to invest in reveal....

Thanks

from orstackview.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.