htmlAppDelegate.h
#import <UIKit/UIKit.h> @interface htmlAppDelegate : NSObject{ UIWindow *window; UIWebView *webView; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UIWebView *webView; @end
htmlAppDelegate.m
#import "htmlAppDelegate.h"
@implementation htmlAppDelegate
@synthesize window;
@synthesize webView;
#pragma mark -
#pragma mark Application lifecycle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[self.window makeKeyAndVisible];
NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:NO];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:path]]];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
}
- (void)applicationWillTerminate:(UIApplication *)application {
}
#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
}
- (void)dealloc {
[window release];
[webView release];
[super dealloc];
}
@end
index.html
<!DOCTYPE html> <html lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charcet=UTF-8" /> <link rel="stylesheet" href="index.css" /> <script type="text/javascript" src="index.js" /> </head> <body> <h1>Don't touch</h1> <button onclick="button()">button</button> </body> </html>
index.js
function button(){
alert("Bang" + "!!!");
}
index.css
h1 {
color : #ff9900;
}
参考
YouTube - How to build iPhone App with HTML5/CSS/JavaScripthttp://www.youtube.com/watch?v=L28lGkoSQ2c&hd=1
![]() 詳解 Objective-C 2.0 改訂版: 荻原 剛志 | ![]() iPhoneプログラミングUIKit詳解リファレンス: 所 友太, 京セラコミュニケーションシステム株式会社 | ![]() iPhone SDK アプリケーション開発ガイド: Jonathan Zdziarski, 近藤 誠 (監訳), 武舎 広幸, 武舎 るみ |



0 コメント:
コメントを投稿