views:

109

answers:

3

does anyone know how to display a number on the screen/iphone simulator? I can load the data and create a x/y graph. Now instead of showing the graph, I load the data value from a text file, and I want to display the number on the screen. Does anyone know what function i can use?

NSString *data =[myText objectAtIndex:i];
output_data_value_to_the_screen(i);

so now let's say data = 1, i want to display the value of the data which is 1 on the screen. if I change the data value of myText to '2', now data = 2 so that 2 will be displayed on the screen instead of '1' ;

A: 

Sounds like you need a GUI Framework for the language you're working with (which I don't immediately recognise). Many languages have their own frameworks that ship with them (Java, VB, C# etc) - others (Python, Ruby, Go etc) might need you to use a third party provider...

Martin Milan
Whoever voted me down here might like to know that the question as it was when I actually submitted this answer made no mention of either the IPhone or it's SDK...
Martin Milan
+2  A: 

The answer is really all about getting to grips with the basics of iPhone/Mac development. You are going to need to google for some basic "Hello World" style applications (but replace Hello World with your number of course)... This question is far too broad for a simple answer on here.

buggles
+2  A: 

Set up a UILabel, put it on the screen, and set the text property on it. Example:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
  CGRect frame = [[UIScreen mainScreen] bounds];
  UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
  int myNumber = 314159;
  label.text = [NSString stringWithFormat:@"%d", myNumber];
  [window addSubview:label];
  [window makeKeyAndVisible];
  return YES;
}

But, yea, this is a pretty newbie question, and a better way to get started (than asking a lot of questions on stackoverflow, at least to begin) is to google around for tutorials and check out the docs at developer.apple.com/iphone.

Tyler
And @Ni, before you even say it, no, this code will not work as is. There is one simple thing you have to do to make it work, which will be immediately obvious to you once you have learned the basics of Cocoa Touch programming. Seek out at least one tutorial, either online or on paper, and follow it, and you will learn what you need to know.
Peter Hosey