Core-Plot graph in a UIViewController - iphone

im trying to put a Coreplot graph in a UIView.
Some questions, should i do it in XIB? or should i do it programmically ?
If so how should i write the codes? etc.
I actually have two Classes. one called GraphView which is supposed to hold the Coreplot graph.
Another called CorePlotViewController.
Thx for looking guys.

hmm i guess i must be some real newb to ask even this type of question :/
but i guess i solved it .
CorePlotViewController *aCorePlotViewController = [[CorePlotViewController alloc] initWithNibName:#"CorePlotViewController" bundle:nil];
[self.view addSubview :aCorePlotViewController.view];

Related

CPTGraphHostingView in a UIView

I was really impressed, and really grateful about the answers I recived last time I asked here.
I have this problem with Core Plot.
I want to have a CPTGraphHostingView inside my UIView so I can have things like labels and scroll views below it.
I am using XCode 3.2 by the way.
How do I do this programmatically? Or with the Interface builder if possible.(I need the instructions to be detailed as im I bit new to this sort of thing)
Thanks for your support.
If you want to add a core plot graph to a UIView you have to add a CPTGraphHostingView as a subview to the UIView. In the example below, hostingView is a UIView and graphObject is a CPTXYGraph.
CPTGraphHostingView *graphHostingView = [[CPTGraphHostingView alloc] initWithFrame:hostingView.bounds];
[hostingView addSubview:graphHostingView];
graphHostingView.hostedGraph = graphObject;
Simple adding CPTGraphHostingView as a subView of UIView [programatically] didn't work for me.
I have searched through many threads and at the end I tried the simplest way to do this - I have created new UIView in interface builder and in this view I have created another UIView and change it to CPTGraphHostingView. Now I can simply create chart [like in tutorials] and link its main UIView anywhere I want.
I don't know why this didn't work programatically but it works from Interface Builder.
I use Xcode 4.2 and Core plot 1.0

How do you transfer data between UIViewControllers?

Currently I am making a game for iPhone, and want each level to be on a different uiviewcontroller (I have tried putting them all on the same view controller, but this just makes it jumpy). However, I need a way to get a high score in the level's view controller and send it back to the menu view controller. I am using the code:
SecondLevelViewController *screen = [[SecondLevelViewController alloc] initWithNibName:nil bundle:nil];
screen.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:screen animated:YES];
[screen release];
to get to the viewcontroller and
[self dismissModalViewControllerAnimated:YES];
to get back. I am familiar with NSUserDefaults, which are what I am using currently to get high scores. However, I know this code resets the level's view controller, that is still fine and even great because i want the level to reset-- but if just i could get data back that would be helpful.
Please put things in simple words, because I am very new to programming.
Thanks in advance!
Steve Becker
PS I am using xcode 4.0...
--------------------------------------------ALSO!!!-------------------------------------
The code I am using, I can only figure out how to get transitions "FlipHorizontal", "CoverVertical", and "CrossDissolve"...But I have seen many other cool transitions on the iPhone--like the page corner flipping like a page in a book. If you know how to do these other transitions, please tell me!!!! Greatly appreciated!!!!!
It's much more standard to have all of the levels on the same UIViewController unless the logic is so different that it's like playing different games. However, you could use a whole slew of different methods to achieve this. For example, you could use the NSNotificationCenter, NSUserDefaults, or a plist.
You will want to use delegation or NSNotifications for this.
Think about the different view controllers like the mafia: every view controller is operating on a need-to-know basis.
Look at this answer I gave before.
you could also use a singleton class to modify and access the sharable data in any class of your projects,
Here is the good SO post on singleton class in objective - C
Singleton shared data source in Objective-C
Edited:
What should my Objective-C singleton look like?
Edited: for Curl page animation : below is the link to blog tutorial and the source code.
http://blog.steventroughtonsmith.com/2010/02/apples-ibooks-dynamic-page-curl.html

Multiple UIWebView in UIView

Anybody please give me some idea that how can i implement multiple UIWebView in UIView just like in BBC App.
hello first create an object and place it on the correct spot then :
[self.view addSubview:YOUR OBECT];
here is an example that will help you (see under Adding a label programmatically)
http://chris-software.com/index.php/2009/04/29/creating-a-view-programmatically/
cheers endo

How do I hide an infoButton in a utility app from the MainViewController when the infoButton is in the RootViewController?

How would I go about updating an object declared in the RootViewController from my MainViewController?
I'm attempting to hide my info button when my iAd is tapped, I have all the relevant pieces of code for the iAd in place, but can't figure out how to code the action. I saw an example of a similar situation online that was like this:
((MainViewController *)parentViewController).infoButton.hidden = #"";
I haven't been able to get that to work though, I just need this one value modifiable from the MVC, can anyone give me a simple suggestion?
P.S. I'm a total n00b and a snippet of code would help a great deal, I'm kind of learning as I go, thanks!
I figured this out through use of the NSNotificationCenter

How to creat UITable, UIButton, UILable, UIImage, UIText, UISlider, UINavigationBar, UITabBar programiticly?

I'm new with the iphone programming and I'm trying to know how to create all of these (UI's) without using the IB, so I'm only asking for the code lines that will create each one of these.
The best way to figure this out is to read through the documentation for each of these classes. Some which are subclasses of UIView can be instantiated with -initWithFrame:, for example.
i am new to iphone/ipad programming , i fallowed below links to create views programmatically... i think these are helpful to u also >>
To create UIButton,UILabel,UIImage,UITextField programmatically
http://www.edumobile.org/iphone/iphone-programming-tutorials/implement-uibutton-uitextfield-and-uilabel-programmatically-in-iphone/
To create UITableView Programatically
http://thesdkblog.com/2011/05/how-to-setup-a-uitableview-programmatically/
To create UINavigationController and UITabbarController Programmatically
http://codenugget.org/how-to-embed-a-navigation-controller-inside-a
http://www.xdracco.net/howto-implement-uinavigationcontroller-uitabbarcontroller-programmatically/
Thanks u..
I've Noticed that a lot of people viewed this question, so I was doing a search on this subject and I came through a great sample code, which can explain how to do a lot of things and here is the link to that sample code:
http://developer.apple.com/iphone/library/samplecode/uicatalog/Introduction/Intro.html
I hope that this will help.