Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5020
bug in viewDidLayoutSubviews WRT chartView's plotAreaRect
posted

There might be a bug in plotAreaRect. It seems that this value isn't updated until sometime after viewDidLayoutSubviews. When the chart's frame changes, I have to performSelector in the future in order to get the new plotAreaRect. Can you look into if this is the case? If you find something, can you suggest a workaround to get this measurement correctly inside viewDidLayoutSubviews?

Parents
No Data
Reply
  • 5020
    posted

    You can see it here:

    -(void)viewDidLayoutSubviews

    {

        NSLog(@"%s - here", __PRETTY_FUNCTION__);

        [self updateStackedImage];

        [self performSelector:@selector(updateStackedImage) withObject:nil afterDelay:0];

    }

    -(void)updateStackedImage

    {

        CGRect chartRect = self.chartView.plotAreaRect;

        NSLog(@"%s - chartRect:%@", __PRETTY_FUNCTION__, NSStringFromCGRect(chartRect));

        

        self.stackedRangeImageView.frame = chartRect;

        self.stackedRangeImageView.image = [self.stackedRangeWidgetController imageOfRangesOfSize:chartRect.size];

    }

    and...

    viewDidLayoutSubviews] - here

    updateStackedImage] - chartRect:{{25, 7}, {225, 98.875641}}

    updateStackedImage] - chartRect:{{25, 7}, {510, 289.87564}}

Children