Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merge new changes from thijs

  • Loading branch information...
commit 7c799cdeffa0531d6231d4abecf20021144df911 1 parent 680441b
Laurent Sansonetti authored
3  PaintHTML/Rakefile
View
@@ -3,7 +3,8 @@ require 'motion/project'
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
- app.name = 'PaintHTML'
+ app.name = 'WebView'
app.device_family = [:iphone, :ipad]
+ # Set the status bar style, other options are UIStatusBarStyleDefault and UIStatusBarStyleBlackOpaque
app.info_plist['UIStatusBarStyle'] = 'UIStatusBarStyleBlackTranslucent'
end
1  PaintHTML/app/app_delegate.rb
View
@@ -1,5 +1,6 @@
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
+ # Remove the following line if you don't want the status bar to be hidden
UIApplication.sharedApplication.setStatusBarHidden(true, withAnimation:UIStatusBarAnimationFade)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = WebViewController.alloc.init
17 PaintHTML/app/web_view_controller.rb
View
@@ -1,10 +1,9 @@
class WebViewController < UIViewController
def loadView
+ # Background color while loading and scrolling beyond the page boundaries
background = UIColor.blackColor
-
self.view = UIView.alloc.initWithFrame(UIScreen.mainScreen.applicationFrame)
self.view.backgroundColor = background
-
webFrame = UIScreen.mainScreen.applicationFrame
webFrame.origin.y = 0.0
@webView = UIWebView.alloc.initWithFrame(webFrame)
@@ -12,25 +11,35 @@ def loadView
@webView.scalesPageToFit = true
@webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)
@webView.delegate = self
- @webView.loadRequest(NSURLRequest.requestWithURL(NSURL.fileURLWithPath(NSBundle.mainBundle.pathForResource('index', ofType:'html'))))
+ @webView.loadRequest(NSURLRequest.requestWithURL(NSURL.fileURLWithPath(NSBundle.mainBundle.pathForResource('index2', ofType:'html'))))
# @webView.loadRequest(NSURLRequest.requestWithURL(NSURL.URLWithString("http://www.fngtps.com/")))
# @webView.loadHTMLString('<h1><a href="http://www.fngtps.com">Click me!</h1>', baseURL:nil)
end
+ # Remove the following if you're showing a status bar that's not translucent
def wantsFullScreenLayout
true
end
+ # Only add the web view when the page has finished loading
def webViewDidFinishLoad(webView)
self.view.addSubview(@webView)
end
+ # Enable rotation
def shouldAutorotateToInterfaceOrientation(interfaceOrientation)
+ # On the iPhone, don't rotate to upside-down portrait orientation
+ if UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPad
+ if interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown
+ return false
+ end
+ end
true
end
+ # Open absolute links in Mobile Safari
def webView(inWeb, shouldStartLoadWithRequest:inRequest, navigationType:inType)
- if inType == UIWebViewNavigationTypeLinkClicked
+ if inType == UIWebViewNavigationTypeLinkClicked && inRequest.URL.scheme != 'file'
UIApplication.sharedApplication.openURL(inRequest.URL)
return false
end
14 PaintHTML/resources/index2.html
View
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
+<title>Sketch</title>
+</head>
+<body>
+
+<a href="index.html">Relative link to drawing web app</a>
+<a href="http://www.fngtps.com">Absolute link, should open in Mobile Safari</a>
+
+</body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.