divyavamsee / core-plot

Automatically exported from code.google.com/p/core-plot
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

setNeedsLayout not called when frame is set #369

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. This only happens when I put a graph inside a view conforming to  
UIScrollViewDelegate
2. Change the size of the UIScrollView which in turn resizes a 
CPGraphHostingView
3. If the frame is made smaller the graph is made smaller, when it is made 
larger it stays at the smaller size.

What is the expected output? What do you see instead?
I expect this to resize the graph.
It will resize only when the frame is made smaller, if the original graph fits 
in the new frame nothing is resized.

What version of the product are you using? On what operating system?
0.9, iOS5

Please provide any additional information below.
I subclassed CPGraphHostingView, when I put that subclass directly beneath the 
root view and resize it everything is resized as expected. So it seems like I 
missed something when implementing the UIScrollViewDelegate. However I also 
have UITableViews inside this scroll view and they are resized as expected - so 
either UITableViews have handling for my mistake or there is a bug.

I was able to workaround the problem by overriding setFrame in my subclassed 
CPGraphHostingView:

- (void) setFrame:(CGRect)frame {
    super.frame = frame;   
    [hostedGraph setNeedsLayout];
}

Adding a [hostedGraph setNeedsLayout]; call to CPGraphHostingView setFrame also 
fixed the issue.

Original issue reported on code.google.com by wwinder....@gmail.com on 23 Nov 2011 at 2:53

GoogleCodeExporter commented 9 years ago
Are you sure you have version 0.9? That version of CPTGraphHostingView does 
include a call to -setNeedsLayout in the -setFrame: method.

See 
http://code.google.com/p/core-plot/source/browse/framework/iPhoneOnly/CPTGraphHo
stingView.m?name=betarelease_0.9#286

Original comment by eskr...@mac.com on 3 Dec 2011 at 2:52

GoogleCodeExporter commented 9 years ago
I thought I updated to the latest core-plot before reporting this but replacing 
the folder didn't update in my project. The change I suggested is already in 
0.9 so please close this issue.

Original comment by wwinder....@gmail.com on 3 Dec 2011 at 3:24

GoogleCodeExporter commented 9 years ago

Original comment by eskr...@mac.com on 3 Dec 2011 at 1:43