
Hello World iPhone Tutorial
5 months ago
A screencast tutorial to help beginner iPhone programmers get started. This tutorial shows how to draw "Hello World!" text on the screen.
This conversation is missing your voice. Take five seconds to join Vimeo or log in.
- Vimeo: About / Blog / Roadmap / Developers / Community Guidelines / Forums / Help! / Site Map
- Legal: © 2008 Vimeo, LLC. All rights reserved. / Terms & Conditions / Privacy Statement



.
2,451
8
10
0
0
Previous Week
-----------------------------------------------------
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;
}
Thanks
Greg
Top work mate.
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!!!
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).
Just wanted to say 'Thanks!'