More
See all Show me
A screencast tutorial to help beginner iPhone programmers get started. This tutorial shows how to draw "Hello World!" text on the screen.
Credits
Tags
8 Likes
  • Anthony Frizalone 5 months ago
    Here is the source code. Also, don't forget, you can download the video yourself with the link on the bottom right under "Downloads." The video there will be as clear as you need it.

    -----------------------------------------------------

    import "MyView.h"

    #define TEXT_LABEL_FONT_SIZE 30.0
    #define TEXT_FIELD_HEIGHT_MULTIPLIER 2.0

    @implementation MyView

    - (id)initWithFrame:(CGRect)aRect
    {
    [super initWithFrame:aRect];
    self.backgroundColor = [UIColor whiteColor];

    CGRect contentFrame = self.frame;
    CGFloat leftMargin = 90.0;
    CGFloat textFieldWidth = contentFrame.size.width * 0.72;
    CGFloat textFieldOriginX = (contentFrame.size.width - textFieldWidth) / 2.0;

    CGRect labelFrame = CGRectMake(textFieldOriginX, leftMargin, textFieldWidth, TEXT_LABEL_FONT_SIZE * TEXT_FIELD_HEIGHT_MULTIPLIER);
    UILabel *someText = [[UILabel alloc] initWithFrame:labelFrame];
    someText.text = @"Hello World!";
    someText.font = [UIFont systemFontOfSize:TEXT_LABEL_FONT_SIZE];
    someText.textColor = [UIColor redColor];
    someText.textAlignment = UITextAlignmentCenter;

    [self addSubview:someText];
    [someText release];

    return self;
    }
  •  
  • Greg 5 months ago
    Excellent tutorial. Any chance of doing a binding tutorial to SQLite similar to the SQLite Books example on the apple site?

    Thanks

    Greg
  •  
  • Ashley Coolman 5 months ago
    Havent done C/C++ for 5 years or so. Stayed back after work and went through this - it was great for me, as I already know the theory behind C/C++. Total newbies would benefit from a few hours on C/C++ tho.

    Top work mate.
  •  
  • Julia Gallardo Lomeli 5 months ago
    Hi Anthony!!

    Nice tutorial, thanks for posting! it really helps...
    Actually I haven´t worked with any C-flavor programming yet.. I´ve been looking everywhere for a way to embed HTML-Javascript into an iPhone app..
    is this possible???

    Thanks!!!
  • Anthony Frizalone 4 months ago
    Heh. Yes and no.

    If you want to write Web Apps, then all you need is JavaScript and HTML (try downloading Dashcode from Apple).

    But, if you want to write native iPhone apps (apps that don't need to be run through Safari, then no, you can't use HTML/JavaScript).
  •  
  • Mark Hernandez 5 months ago
    Good job Anthony! We've featured your videos in the beginners section at iPhoneDevForums.com. I learned a lot! MarkyMark
  •  
  • Gregory Haynes 4 months ago
    Hey Anthony,

    Just wanted to say 'Thanks!'
  •  
  • arthur mcarthy 3 months ago
    Great tutorial Anthony.. i was wondering what version of xcode are you using? when I create a new project it doesn´t create the MyView files and a bunch of code is missing in the other files (Hello_World_TestAppDelegate.h & Hello_World_TestAppDelegate.m) i typed in the code and worked... thanks again. cheers
  •  
  • bob schoenburg 1 month ago
    Hi Anthony Thanks for the great tutorials. Have you posted to source code for the Table View Test?
  •  
  • Tobin Fisher 25 days ago
    This looks like a great tutorial, however, when I try to follow along in xCode, I'm getting stuck on step 1, as I don't see "Cocoa Touch Application" as a new project option for iPhone. I see "Navigation Based Application" in the top left and then "OpenGL ES Application", "Tab Bar Application" and so on, but nothing for Cocoa Touch. Tough start! Any ideas or suggestions would be much appreciated.
  •  
This conversation is missing your voice. Take five seconds to join Vimeo or log in.

Sponsored by:

1 Related collections
Statistics
  •  
    plays
    likes
    comments
  • Total
    plays 2,451
    plays 8
    plays 10
  • Aug 29th
    plays 22
    plays 0
    plays 0
  • Aug 28th
    plays 29
    plays 0
    plays 0
  • Aug 27th
    plays 20
    plays 0
    plays 0
  • Aug 26th
    plays 32
    plays 0
    plays 0
  • Aug 25th
    plays 38
    plays 0
    plays 0
  • Aug 24th
    plays 26
    plays 0
    plays 0
  • Aug 23rd
    plays 29
    plays 0
    plays 0
  • Aug 22nd
    plays 32
    plays 0
    plays 0
Previous Week

See referrers
Downloads
Please join Vimeo or log in to download the original file. It only takes a few seconds.