Display a number on the screen Phone SDK

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' ;

Answers


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.


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.


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...


Need Your Help

Switch Statement and While Loop

java while-loop switch-statement do-while

I am writing a database program that allows the user to search for employees and it opens up a menu for them.in my Main() I have to prompt the User to press m to open up the menu() or q to open up

RibbonWindow appears black when fading in on load

c# wpf xaml animation storyboard

I'm trying to show fade-in animation on loading RibbonWindow.