440Forums  |  MacMusic.org  |  PcMusic.org  |  440tv  |  Zicos  |  AudioLexic
floating   {key13}


A Simpler "Hello World" for the iPhone

MacDevCenter

Friday August 3, 2007. 07:34 PM
MacDevCenter

Although there’s already a “hello world’ floating out there for the iPhone, it involves a number of complicated classes. I decided to simplify and create a new “Hello World” from scratch based only on UIWindow, UIView and UITextView. The code follows after the jump. Makefile CC=arm-apple-darwin-cc LD=$(CC) LDFLAGS=-lobjc -framework CoreFoundation -framework Foundation -framework UIKit -framework LayerKit -framework CoreGraphics all: SampleApp SampleApp: mainapp.o SampleApp.o $(LD) $(LDFLAGS) -v -o $@ $^ %.o: %.m $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ clean: rm -f *.o SampleApp mainapp.m #import <UIKit/UIKit.h> #import "SampleApp.h" int main(int argc, char **argv) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; return UIApplicationMain(argc, argv, [SampleApp class]); } SampleApp.h #import <CoreFoundation/CoreFoundation.h> #import <Foundation/Foundation.h> #import <UIKit/CDStructures.h> #import <UIKit/UIWindow.h> #import <UIKit/UIView-Hierarchy.h> #import <UIKit/UIHardware.h> #import <UIKit/UIKit.h> #import <UIKit/UIApplication.h> #import <UIKit/UITextView.h> #import <UIKit/UIView.h> @interface SampleApp : UIApplication { UIView *mainView; UITextView *textView; } @end SampleApp.m #import "SampleApp.h" @implementation SampleApp - (void) applicationDidFinishLaunching: (id) unused { UIWindow *window; struct CGRect rect = [UIHardware fullScreenApplicationContentRect]; rect.origin.x = rect.origin.y = 0.0f; window = [[UIWindow alloc] initWithContentRect: rect]; mainView = [[UIView alloc] initWithFrame: rect]; textView = [[UITextView alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)]; [textView setEditable:YES]; [textView setTextSize:14]; [window orderFront: self]; [window makeKey: self]; [window _setHidden: NO]; [window setContentView: mainView]; [mainView addSubview:textView]; [textView setText:@"Hello World"]; } @end
Although there’ already “ hello world’ floating there iPhone Simpler Hello World iPhone
A Simpler "Hello World" for the iPhone Read more at MacDevCenter
www.oreillynet.com/mac/blog/2007/08/a_simpler_hello_world_for_the.html?CMP=OTC-13IV03560550&ATT=A+Simpler+Hello+World+for+the+iPhone

 

 Related News 
Far EasTone in talks with Apple to sell iPhone in Taiwan Far EasTone in talks with Apple to sell iPhone in Taiwan
 Mac Daily News 08/15/07 07 PM 
RUMOR: Apple iPhone coming to France with Orange as exclusive... RUMOR: Apple iPhone coming to France with Orange as exclusive...
 Mac Daily News 08/15/07 07 PM 
A A "Unsanctioned" iPhone App: Pong (w/pictures and source)
 MacDevCenter 08/15/07 05 PM 
REVO Case for Apple iPhone - New at GadgetLocker REVO Case for Apple iPhone - New at GadgetLocker
 AppleLinks 08/15/07 04 PM 
News: Pacific Design teams with Chloe Dao for iPhone, iPod cases News: Pacific Design teams with Chloe Dao for iPhone, iPod cases
 iPod Lounge 08/15/07 04 PM 
Facebook launches customized Apple iPhone site Facebook launches customized Apple iPhone site
 Mac Daily News 08/15/07 04 PM 
Audi Gets iPhone Integration Audi Gets iPhone Integration
 AppleLinks 08/15/07 04 PM 
Facebook, book previews for iPhone Facebook, book previews for iPhone
 MacNN 08/15/07 03 PM 
Apple iPhone unlocked via ‘Turbo SIM’ Apple iPhone unlocked via ‘Turbo SIM’
 Mac Daily News 08/15/07 03 PM 
iPodObserver - TurboSIM Unlocks iPhone iPodObserver - TurboSIM Unlocks iPhone
 TheMacObserver 08/15/07 03 PM 
iPhone & iPod cause Flash memory shortage iPhone & iPod cause Flash memory shortage
 Macworld UK 08/15/07 02 PM 
Audi drives for iPhone Audi drives for iPhone
 Macworld UK 08/15/07 01 PM 
Orange and Apple for French iPhone? Orange and Apple for French iPhone?
 Macworld UK 08/15/07 01 PM 
AdMob Launches Mobile Advertising Unit for Apple iPhone AdMob Launches Mobile Advertising Unit for Apple iPhone
 AppleLinks 08/15/07 07 AM 
Briefly: clay iPhone; MacToSchool; iMac review Briefly: clay iPhone; MacToSchool; iMac review
 MacNN 08/15/07 02 AM 
Touchscreen deadspots: What to try before taking your iPhone ... Touchscreen deadspots: What to try before taking your iPhone ...
 MacFixIt 08/15/07 12 AM 
Audi offers full iPhone integration option Audi offers full iPhone integration option
 MacNN 08/14/07 11 PM 
iPodObserver - Logic3 Launches iPhone Portable Speakers iPodObserver - Logic3 Launches iPhone Portable Speakers
 TheMacObserver 08/14/07 07 PM 
iPhone 3G to be available in more than 70 countries iPhone 3G to be available in more than 70 countries
 Apple HotNews 08/14/07 06 PM 
Lights Off for the iPhone Lights Off for the iPhone
 TidBITS 08/14/07 05 PM 
iPhone completely unlocked via Turbo SIM? iPhone completely unlocked via Turbo SIM?
 MacNN 08/14/07 05 PM 

Search

Mac Zicos
Sun September 7, 11:49 AM
floating   {key13}