Execute HelloWorld program in iPad

This is the “HelloWorld” example, i am going to run this application in the iPad. For the iPad application , required “iPhone SDK 3.2″ , so first install the iPhoneSDK 3.2 . There have so many way to display the HelloWorld in the iPad, but i’ll show you “HelloWorld” example using Interface Builder and writing little code.This is the very simple application. So let see how it will be worked.

Be Sociable, Share!

This is the “HelloWorld” example, i am going to run this application in the iPad. For the iPad application , required “iPhone SDK 3.2″ , so first install the iPhoneSDK 3.2 . There have so many way to display the HelloWorld in the iPad, but i’ll show you “HelloWorld” example using Interface Builder and writing little code.This is the very simple application. So let see how it will be worked.

Step 1: Open the Xcode and create a new Xcode project usingView base application template. Give the application name “Button Fun iPad”.

Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: xpand classes and notice Interface Builder created the Button_Fun_iPadViewController class for you. Expand Resources and notice the template generated a separate nib, Button_Fun_iPadViewController.xib, for the “Button Fun iPad”.

Step 4: In the Button_Fun_iPadViewController.h file, we have added UILabel for display the text and added IBAction buttonPressed: so make the following changes in the file.

#import <UIKit/UIKit.h>

  @interface Button_Fun_iPadViewController : UIViewController {
  IBOutlet UILabel *statusText;
}
  @property (retain, nonatomic) UILabel *statusText;

  -(IBAction)buttonPressed:(id)sender;

Step 5: After changing in the Button_Fun_iPadViewController.h, double click the Button_Fun_iPadViewController.xib file open it to the Interface Builder.

a) Open the View window, first drag the label from the library and place it to the view window and select the label and bring up Attribute Inspector and delete the text.

b) Next drag a Round Rect from the library and place it to the view window. double click the Round Rect and give the name “ClickMe”.

c) Now connect the File’s Owner icon to the View icon and select view.

d) Connect File’s Owner icon to label and select ”statusText”.

e) Select the Round Rect from the view window and bring up connection Inspector.Drag from the TouchUpInside to the File’s Owner icon and select buttonPressed: action. Now save the Button_Fun_iPadViewController.xib file, close it and go back to the Xcode.

Step 6: Open the Button_Fun_iPadViewController.m file and  make the following changes in the file:

-(IBAction)buttonPressed:(id)sender
  {
    NSString *newText = [[NSString alloc] initWithFormat:
    @" Hello World!!!"];
    statusText.text = newText;
    [newText release];
  }

Step 7: Now compile and run the application in the Simulator.

You can downloaded SourceCode from here Button Fun iPad

Be Sociable, Share!
WP Greet Box icon
Hello there! If you are new here, you might want to subscribe to the RSS feed for updates on this topic, and free programming tips and tricks and source code            snippets.

7 Responses to “Execute HelloWorld program in iPad”

  1. Colin says:

    Hi,

    I followed the steps above very closely (4 times) but I cannot do this section. The options are grayed out, so I can\’t set them.

    Step 5:

    c) Now connect the File’s Owner icon to the View icon and select view.

    d) Connect File’s Owner icon to label and select ”statusText”.

    e) Select the Round Rect from the view window and bring up connection Inspector.Drag from the TouchUpInside to the File’s Owner icon and select buttonPressed: action. Now save the Button_Fun_iPadViewController.xib file, close it and go back to the Xcode.

    Is there something obvious that you think I may be doing wrong? A rookie mistake? Any suggestions would be greatly appreciated.

    Thanks,

    Colin

  2. Sushant says:

    I have attached screenshot in our blog for this application. Please read once again, if you have any problem then please let us know.

  3. Brandon says:

    I’m having the same problem as Colin with the step:
    Step 5: c) Now connect the File’s Owner icon to the View icon and select view.

    How do I get that blue line to appear to make the connection between the File’s Owner icon and the View icon?

  4. Sushant says:

    @Brandon and Colin please follow the below step.

    1. Select the File’s Owner icon from the Button_Fun_iPadViewController.xib file.
    2. Right click on the File’s Owner icon and drag the File’s Owner icon to the View icon, and select view.

    Hope this will help you. Still you have problem then please let us know.

  5. lak says:

    hi sushanth,

    i want to develop an settings view as like in ipad ..
    any ideas how to develop this type app …

  6. Mark says:

    Thank you so much for this simple and effective tutorial. It worked for me first time!

    I am using Xcode Version 3.2.3 (1688) on Mac OS X 10.6.4.

  7. Mark says:

    Thank you so much for this simple and effective tutorial. It worked for me the first time!

    I am using Xcode Version 3.2.3 (1688) on Mac OS X 10.6.4.

Leave a Reply

*

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Our Mobile Training Courses

EDUmobile.ORG offers the following 4 Mobile Training Courses. Our iPhone Training Course is very popular, with over 200 developers in training.

learn iphone programming
© 2010 EDUmobile.ORG