çªç¶ã§ãããiPhone使ã£ã¦ã¾ãï¼
åã¯æ¯æ¥iPhone使ã£ã¦ã¾ããããã£ã±ãé¢ç½ãã§ãã
ã¢ããªããã£ã±ããããã§ãæ¯æ¥æ°ããã¢ããªå
¥ããããã¦éãã§ã¾ãã
ãã£ã±ããããªã¢ããªä½ã£ã¦ã¿ãããªãã¾ãããï¼
åã¯ãªã£ã¡ãã£ãã®ã§ãã¬ãããã©ã¤ã§ãï¼
ã¾ãã¯æ¬è²·ãã¾ããï¼
ããããã調ã¹ã¦ã¿ãã¨ãã¾ãã¯ãããªçµæã«ã
ã»ç»é¢ä½æã«Interface Builderã¯ä½¿ããªãã»ãããã
ã»ãã®æ¹ãå¾ã
ãã«ã¹ã¿ãã¤ãºãããã
ãªãã»ã©ããã
ããåæã§æ¢ããæ¬ãããã
å
¨ã¦Interface Builder使ããã«ç»é¢ä½æããæ¹æ³ãï¼è±èªããã©ï¼æ¸ãã¦ããã¾ã
iPhone SDK Application Development: Building Applications for the AppStore
- ä½è : Jonathan Zdziarski
- åºç社/ã¡ã¼ã«ã¼: O'Reilly Media
- çºå£²æ¥: 2009/02/06
- ã¡ãã£ã¢: ãã¼ãã¼ããã¯
- è³¼å ¥: 2人 ã¯ãªãã¯: 110å
- ãã®ååãå«ãããã° (14件) ãè¦ã
ã¡ãªã¿ã«æ°å®¿ã®ã³ã¯ã¼ã³ã¿ã¯ã¼ã®ããã¯ãã¡ã¼ã¹ãã§å£²ã£ã¦ã¾ãï¼
ããã¸ã§ã¯ãä½æï¼
XCodeã¯ã¤ã³ã¹ãã¼ã«æ¸ãiPhone SDKããã¦ã³ãã¼ãæ¸ã§ãã
ãªã®ã§ãæ©éXCodeãèµ·åãã¦ãããã¸ã§ã¯ããä½æãã¾ãã
XCodeä¸ã§ããã¡ã¤ã«ãâãæ°è¦ããã¸ã§ã¯ãããé¸æãã¾ã
ããã¨ããããªç»é¢ãã§ã¦ããã®ã§ããWindow-Based Applicationããé¸æãã¾ãã
ããã¸ã§ã¯ãåã¯ãHelloWorldãã¨ãã¦å®äºãã¾ãã
Interface Buiderã¨ã®é¢ä¿ãæã¡åãï¼
åãã«Interface Builderã¨ã®é¢ä¿ãæã¡åãã¾ãã
Resourcesãã©ã«ãã«ããMainWindow.xibãã¡ã¤ã«ãåé¤ãã¾ãã
次ã«ãåãResourcesãã©ã«ãã«ããInfo.plistãã¡ã¤ã«ãéã
æçµè¡ã®[Main nib file base name]ã®è¡ãåé¤ãã¾ãã
æå¾ã«Other Sourcesãã©ã«ãã«ããmain.mãã¡ã¤ã«ãéãã¾ãã
UIApplicationMainã¡ã½ãããå¼ã³åºãã¦ããè¡ããä¸è¨ã®ããã«æ¸ãæãã¾ãã
int retVal = UIApplicationMain(argc, argv, nil, @"HelloWorldAppDelegate");
ããï¼ã½ã¼ã¹ããããï¼ï¼ï¼
ã¾ãã¯ãHelloWorldAppDelegate.hã§ãã
#import <UIKit/UIKit.h> @interface MainView : UIView { UITextView *textView; } @end @interface HelloWorldAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; MainView *myMainView; } @property (nonatomic, retain) IBOutlet UIWindow *window; @end
次ã«HelloWorldAppDelegate.mã§ãã
#import "HelloWorldAppDelegate.h" @implementation MainView - (id)initWithFrame:(CGRect) rect{ self = [super initWithFrame:rect]; if(self != nil){ textView = [[UITextView alloc] initWithFrame:rect]; textView.text = @"Hello World!"; [self addSubview:textView]; } return self; } -(void)dealloc{ [textView release]; [super dealloc]; } @end @implementation HelloWorldAppDelegate @synthesize window; - (void)applicationDidFinishLaunching:(UIApplication *)application { NSLog(@"start"); CGRect screenBounds = [[UIScreen mainScreen] applicationFrame]; CGRect windowBounds = screenBounds; windowBounds.origin.y = 0.0; self.window = [[UIWindow alloc] initWithFrame: screenBounds]; myMainView = [[MainView alloc] initWithFrame:windowBounds]; [window addSubview:myMainView]; // Override point for customization after application launch [window makeKeyAndVisible]; } - (void)dealloc { [myMainView release]; [window release]; [super dealloc]; } @end
ããã§ããã«ããã¦å®è¡ããé¸ã¶ã¨iPhoneã·ãã¥ã¬ã¼ã¿ãç«ã¡ä¸ãã
ãããªç»é¢ãã§ãã°æåã§ããï¼
ã§ããã§ããï¼ã¨ãããã¨ã§
iPhoneã¢ããªã§Interface Builder使ããã«éçºããéã®ãã¥ã¼ããªã¢ã«ã«ã§ããªãã°å¹¸ãã§ãã