PLEASE HELP. Just starting out.

Discussion in 'iPhone/iPad Programming' started by Abunga, Jan 25, 2011.

  1. macrumors newbie


    Hello, I have jut started using Objective-C and Object Oriented programming in general. Could somebody please help me with this somewhat simple coding?

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
        // Override point for customization after application launch.
        UILabel *myMessage;
    	int value1;
    	int value2;
    	value1 = 10;
    	value2 = value1 * 2;
    	myMessage=[[UILabel alloc] initWithFrame:CGRectMake(25,225,300,50)];
    	NSLog(@"The value is %d.", value2);	
    	[window addSubview:myMessage];
    	[window makeKeyAndVisible];
    	return YES;
    Although this is relatively simple in programming terms, i am trying to make it so that the NSLog I create will show up on the IPhone screen and not just in the console window. In other words, what needs to be used instead of NSLog etc.

    Sorry it's a bit basic, but after years of working with languages like Basic, C has always bewildered me. This answer seems to specific for books to answer.

    Thanks for any help you can give me.

    Abunga. :(
  2. Moderator


    Staff Member

    What books are you using?

    By the time you get to Cocoa Touch, this should be handled.

    e.g. if you are working through Kochan's book work through the iPhone fraction calculator and you should be able to figure it out.

    (hint, you need to build an interface)

  3. macrumors newbie


    Mmmmm, thanks.

    Thanks for the response. I am using, amongst online resources, a SAMS Teach Yourself book and I also have Objective C for Dummies as a reference.

    I know that you have to build an interface, and have done, but can't understand how to make the label show the variable.

    Mmmmmm, it become cloudier by the day.


    Abunga. :confused:
  4. Moderator


    Staff Member

    Do your books cover how to make a UILabel show any text? Once you're comfortable with that concept, you can move on to getting your label to show specific text. Then, from there, it's on to realizing that what NSLog takes (mainly) as an argument is pretty much the same as what setting a label's text does.
  5. Moderator


    Staff Member

    Is this the SAMS book? If so, it shows you what to do both in Chapter 2 and Chapter 5.

    The Objective C for Dummies book gets lousy ratings on Amazon, so I'll ignore it.

  6. macrumors newbie



    Thanks for the help given peeps, probably obvious really, from your perspective.

    Will look into other books too. SAMS is very good generally, and yes, the Dummies book is the same as all other Dummies books in that never pushes far enough when you want to know something.

    Cheers again.

    (Don't suppose anybody knows how you put a signature on to postings in this forum? Have tried and failed.)
  7. Moderator


    Staff Member

    User CP (left side in the menu bar near the top of the page) > Edit Signature
  8. macrumors newbie



    Thanks dejo.


Share This Page