Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-05-2011, 02:58 PM   #1 (permalink)
Registered Member
 
Join Date: Jun 2011
Posts: 23
Chizbang is on a distinguished road
Default How do I get this code to work with my CPTGraphHostingView?

Hey!
I know im asking allot of questions about Core Plot, im really sorry, but I keep bumping into problems.
This is how far I have gotten:


The Core Plot view is at the top of my ViewController.
The reason why I want it like that is because I want text underneath.
Anyway:
This is what I did to get this far:
In MyProjectViewController.m's view did load method:
Code:
plotView initWithFrame:CGRectMake(0, 0, 320, 200)];
	[self.view addSubview:plotView];
	[plotView release];
	CPTTestAppBarChartController * barChartTopViewController= [[CPTTestAppBarChartController alloc] init];
	[barChartTopViewController viewDidLoad];
I implemented the Core Plot view in the Interface builder and linked the plotView variable to the Core Plot View in the Interface Builder.
The code above makes the Core Plot view set its size so I can have it at the top of the main view controller.
And the [barChartTopViewController viewDidLoad] is to activate the code within the viewDidLoad method in the barChartTopViewController.
Here is the barChartTopViewControllers .ms code:
[Objective C] #import "barChartTopViewController.h" @implementation barChartTopViewController - Pastebin.com
Thats the code thats in the barChartTopViewController.m (I made that class in the interface builder by pressing: File > Write Class Files)
I know its simple, but please go easy on me, im a total noob to all this, I just want to experiment with this stuff.
The Core Plot Example Project has the exact same code and configuration (Except the bar chart is an separate view rather then it being integrated into a view) so I have copied everything and It still doesn't work.
What do I need to do to get the code to execute to the CPTGraphHostingView (The code in the bar chart class should have made a bar chart but it did not)?
I know I have made a similar question, but I have tried a different way to last time.
So please, help me out.
I would be really grateful.
Thank you very very much.
Chizbang is offline   Reply With Quote
Old 11-05-2011, 06:42 PM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by Chizbang View Post
Hey!
I know im asking allot of questions about Core Plot, im really sorry, but I keep bumping into problems.
This is how far I have gotten:


The Core Plot view is at the top of my ViewController.
The reason why I want it like that is because I want text underneath.
Anyway:
This is what I did to get this far:
In MyProjectViewController.m's view did load method:
Code:
plotView initWithFrame:CGRectMake(0, 0, 320, 200)];
	[self.view addSubview:plotView];
	[plotView release];
	CPTTestAppBarChartController * barChartTopViewController= [[CPTTestAppBarChartController alloc] init];
	[barChartTopViewController viewDidLoad];
I implemented the Core Plot view in the Interface builder and linked the plotView variable to the Core Plot View in the Interface Builder.
The code above makes the Core Plot view set its size so I can have it at the top of the main view controller.
And the [barChartTopViewController viewDidLoad] is to activate the code within the viewDidLoad method in the barChartTopViewController.
Here is the barChartTopViewControllers .ms code:
[Objective C] #import "barChartTopViewController.h" @implementation barChartTopViewController - Pastebin.com
Thats the code thats in the barChartTopViewController.m (I made that class in the interface builder by pressing: File > Write Class Files)
I know its simple, but please go easy on me, im a total noob to all this, I just want to experiment with this stuff.
The Core Plot Example Project has the exact same code and configuration (Except the bar chart is an separate view rather then it being integrated into a view) so I have copied everything and It still doesn't work.
What do I need to do to get the code to execute to the CPTGraphHostingView (The code in the bar chart class should have made a bar chart but it did not)?
I know I have made a similar question, but I have tried a different way to last time.
So please, help me out.
I would be really grateful.
Thank you very very much.
You didn't post the whole statement that creates a plotview.

The first line you quoted:

Code:
plotView initWithFrame:CGRectMake(0, 0, 320, 200)]
Would not compile like that, since it has a closing bracket but not an opening bracket.

In Cocoa, you create objects by first allocating them, then sending them an init message of some sort. That line should read something like this:

Code:
plotView = [[PlotViewClass alloc] initWithFrame:CGRectMake(0, 0, 320, 200)];
I don't know what class your plotView object is supposed to be, so I just used "PlotViewClass" above. Replace that with the class name for this object.

Also, further down, you create a CPTTestAppBarChartController object, then never do anything with it.

Code:
	CPTTestAppBarChartController * barChartTopViewController= [[CPTTestAppBarChartController alloc] init];
	[barChartTopViewController viewDidLoad];

Is that a subclass of UIViewController? If so, you probably need to make that the parent class for the whole screen that will contain your bar chart. Except under iOS5 on the iPad, you really shouldn't mix the contents of multiple view controllers on a single screen.

Finally, you probably shouldn't be calling a view controller's viewDidLoad method directly. The system calls that method when view controllers are created and their views get loaded. You rarely, if ever, call them yourself.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 405
17 members and 388 guests
7twenty7, Alex-alex, Apptronics RBC, baja_yu, dre, FrankWeller, gwelmarten, ipodphone, jeroenkeij, jleannex55, matador1978, n00b, pbart, reficul, Retouchable, Sami Gh, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,125
Posts: 402,910
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:19 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0