Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JBBarChartView Bar Height Problem With Storyboard/Autolayout #19

Closed
xanderdunn opened this issue Mar 13, 2014 · 2 comments
Closed

JBBarChartView Bar Height Problem With Storyboard/Autolayout #19

xanderdunn opened this issue Mar 13, 2014 · 2 comments

Comments

@xanderdunn
Copy link

When I setup my view controllers in a storyboard with autolayout, I end up with a JBBarChartView that starts animating the bars on viewDidAppear, but then the bars just stop and disappear (1st image below). On the other hand, an identical setup that I create in code rather than in storyboard works just fine (2nd image below).

img_3629
img_3628

terryworona pushed a commit that referenced this issue Mar 13, 2014
@terryworona
Copy link
Collaborator

Hey @AlexDunn, since nib's instantiate themselves with initWithCoder:, add the following to your controller:

- (id)initWithCoder:(NSCoder *)aDecoder
{
    self = [super initWithCoder:aDecoder];
    if (self)
    {
        [self initFakeData]; // fake rain data
        _monthlySymbols = [[[NSDateFormatter alloc] init] monthSymbols];
    }
    return self;
}

I've fixed this issue in the demo project via commit: 3d5e5c3

@xanderdunn
Copy link
Author

Oh, I see! Yeah, the problem was just a lack of data when it initialized from a storyboard.

Beyond that, to prevent an exception where the graph view's size has not yet been determined when using auto layout constraints, I had to add my constraints in viewDidLoad and then add my footerView and headerView in viewDidLayoutSubviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants