gujjula / core-plot

Automatically exported from code.google.com/p/core-plot
0 stars 0 forks source link

Automatic Interface Rotation did not work #313

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create simple application where CPTGraphHostingView is
direct child of root UIWindow. shouldAutorotateToInterfaceRotation of root 
controller returns YES for portrait and landscape orientations.
2. Rotate Device from initial portrait to londscape orientation.

What is the expected output? What do you see instead?
The Graphic shall rotate and resize. While the graphic rotates it is
not resized: the width stays the now to small width of portrait orientation.

What version of the product are you using? On what operating system?
Version is 0.4 ; iOs 4.3 IPhone

Please provide any additional information below.
Autorotation did work with the coreplot supplied example.
The difference is that in the supplied example there are UIViews
between the root UIWindow and the CPTGraphHostingView (from
the Tab Bar Controller), which is not the case here. CPTGraphHostingView frame 
width and height do not change, when CPTGraphHostingView is a direct child of 
root UIWindow. Reason: frame is specified in parent view coordinates and the 
parent view (root UIWindow) is not rotated.
Workaround: Derive own class from CPTGraphHostingView and overwrite setBounds 
method so that it calls super setBounds AND
hostedGraph.frame = self.bounds;
Other Workaround: Create dummy UIView between root UIWindow and 
CPTGraphHostingView.

Original issue reported on code.google.com by catje...@googlemail.com on 8 Aug 2011 at 10:50

GoogleCodeExporter commented 9 years ago
Did you set the autoresizingMask on the CPTGraphHostingView? You can do it in 
code or in Interface Builder (IB). In the version of IB built into Xcode 4, the 
Mode property under "View" should be "Scale to Fill".

Original comment by eskr...@mac.com on 9 Aug 2011 at 1:25

GoogleCodeExporter commented 9 years ago
I can't have rotation with the work around provided. Could you please provide 
some more details ?

Original comment by putty...@gmail.com on 27 Sep 2011 at 8:22

GoogleCodeExporter commented 9 years ago
CPTGraphHostingView is a subclass of UIView. You can adjust its size and 
position like any other UIView. It will resize the hosted graph to fill its 
bounds.

Original comment by eskr...@mac.com on 28 Sep 2011 at 12:06

GoogleCodeExporter commented 9 years ago
The Mode property under "View" has been set to "Scale to Fill"

Original comment by catje...@googlemail.com on 30 Sep 2011 at 1:11

GoogleCodeExporter commented 9 years ago
I have checked out with newest core plot version and the problem remains.
To simplify things I have attached a sample Xcode project, which demonstrates 
the point.
Compile and run that program in iPhone simulator and note that graph is not 
rescaled if rotated left or right from the default vertical orientation.
Now in Plot2ViewController.m find overwritten setBounds method of 
CPTGraphHostingViewPatched and comment in the two lines (if (!..) 
hostedGraph.frame = self.bounds;
Rerun and observe that scaling is now correct (this is workaround 1)
For workaround 2 : put back the comments around (if (!..) hostedGraph.frame = 
self.bounds). 
Find the line #if 0 in same file and change to #if 1.
Finally edit the Plot2ViewController.xib and change the class for "Graph 
Hosting View" from "CPTGraphHostingViewPatched" to a simple UIView.
Rerun and observe that scaling after rotation is still correct (this is 
workaround 2)

Original comment by catje...@googlemail.com on 30 Sep 2011 at 1:56

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision b60f5e9793fd.

Original comment by eskr...@mac.com on 1 Oct 2011 at 8:36