Permalink
Browse files

- webview loads page and prints document title

  • Loading branch information...
1 parent 446559b commit bf59858a5e547f68ce503382dea43f21110a117e @smistry-toushay committed Dec 4, 2013
@@ -13,8 +13,6 @@
AF51B6F5184F825A00AF89F0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = AF51B6F3184F825A00AF89F0 /* InfoPlist.strings */; };
AF51B6F7184F825A00AF89F0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AF51B6F6184F825A00AF89F0 /* main.m */; };
AF51B6FB184F825A00AF89F0 /* APVAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AF51B6FA184F825A00AF89F0 /* APVAppDelegate.m */; };
- AF51B6FE184F825A00AF89F0 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AF51B6FC184F825A00AF89F0 /* Main_iPhone.storyboard */; };
- AF51B701184F825A00AF89F0 /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AF51B6FF184F825A00AF89F0 /* Main_iPad.storyboard */; };
AF51B704184F825A00AF89F0 /* APVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AF51B703184F825A00AF89F0 /* APVViewController.m */; };
AF51B706184F825A00AF89F0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AF51B705184F825A00AF89F0 /* Images.xcassets */; };
AF51B70D184F825A00AF89F0 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF51B70C184F825A00AF89F0 /* XCTest.framework */; };
@@ -45,8 +43,6 @@
AF51B6F8184F825A00AF89F0 /* ApportableWebView-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ApportableWebView-Prefix.pch"; sourceTree = "<group>"; };
AF51B6F9184F825A00AF89F0 /* APVAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APVAppDelegate.h; sourceTree = "<group>"; };
AF51B6FA184F825A00AF89F0 /* APVAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = APVAppDelegate.m; sourceTree = "<group>"; };
- AF51B6FD184F825A00AF89F0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = "<group>"; };
- AF51B700184F825A00AF89F0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = "<group>"; };
AF51B702184F825A00AF89F0 /* APVViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APVViewController.h; sourceTree = "<group>"; };
AF51B703184F825A00AF89F0 /* APVViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = APVViewController.m; sourceTree = "<group>"; };
AF51B705184F825A00AF89F0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
@@ -116,8 +112,6 @@
children = (
AF51B6F9184F825A00AF89F0 /* APVAppDelegate.h */,
AF51B6FA184F825A00AF89F0 /* APVAppDelegate.m */,
- AF51B6FC184F825A00AF89F0 /* Main_iPhone.storyboard */,
- AF51B6FF184F825A00AF89F0 /* Main_iPad.storyboard */,
AF51B702184F825A00AF89F0 /* APVViewController.h */,
AF51B703184F825A00AF89F0 /* APVViewController.m */,
AF51B705184F825A00AF89F0 /* Images.xcassets */,
@@ -232,9 +226,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- AF51B701184F825A00AF89F0 /* Main_iPad.storyboard in Resources */,
AF51B706184F825A00AF89F0 /* Images.xcassets in Resources */,
- AF51B6FE184F825A00AF89F0 /* Main_iPhone.storyboard in Resources */,
AF51B6F5184F825A00AF89F0 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -287,22 +279,6 @@
name = InfoPlist.strings;
sourceTree = "<group>";
};
- AF51B6FC184F825A00AF89F0 /* Main_iPhone.storyboard */ = {
- isa = PBXVariantGroup;
- children = (
- AF51B6FD184F825A00AF89F0 /* Base */,
- );
- name = Main_iPhone.storyboard;
- sourceTree = "<group>";
- };
- AF51B6FF184F825A00AF89F0 /* Main_iPad.storyboard */ = {
- isa = PBXVariantGroup;
- children = (
- AF51B700184F825A00AF89F0 /* Base */,
- );
- name = Main_iPad.storyboard;
- sourceTree = "<group>";
- };
AF51B715184F825A00AF89F0 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
@@ -475,6 +451,7 @@
AF51B71E184F825A00AF89F0 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
AF51B71F184F825A00AF89F0 /* Build configuration list for PBXNativeTarget "ApportableWebViewTests" */ = {
isa = XCConfigurationList;
@@ -483,6 +460,7 @@
AF51B721184F825A00AF89F0 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
@@ -6,41 +6,21 @@
// Copyright (c) 2013 Sandeep Mistry. All rights reserved.
//
+#import "APVViewController.h"
+
#import "APVAppDelegate.h"
@implementation APVAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
- // Override point for customization after application launch.
+ self.window = [[UIWindow alloc] init];
+
+ self.window.rootViewController = [[APVViewController alloc] init];
+
+ [self.window makeKeyAndVisible];
+
return YES;
}
-
-- (void)applicationWillResignActive:(UIApplication *)application
-{
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
-}
-
-- (void)applicationDidEnterBackground:(UIApplication *)application
-{
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
-}
-
-- (void)applicationWillEnterForeground:(UIApplication *)application
-{
- // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
-}
-
-- (void)applicationDidBecomeActive:(UIApplication *)application
-{
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
-}
-
-- (void)applicationWillTerminate:(UIApplication *)application
-{
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
-}
@end
@@ -8,6 +8,8 @@
#import <UIKit/UIKit.h>
-@interface APVViewController : UIViewController
+@interface APVViewController : UIViewController <UIWebViewDelegate>
+
+@property (nonatomic, strong) UIWebView *webView;
@end
@@ -14,16 +14,39 @@ @interface APVViewController ()
@implementation APVViewController
+- (void)loadView
+{
+ self.view = [[UIView alloc] init];
+ self.view.backgroundColor = [UIColor darkGrayColor];
+ self.view.frame = CGRectMake(0, 0, 320, 480);
+ self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
+
+ UIWebView *webView = [[UIWebView alloc] init];
+ webView.frame = CGRectMake(20, 20, 280, 440);
+ webView.delegate = self;
+ webView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
+ [self.view addSubview:webView];
+ self.webView = webView;
+}
+
- (void)viewDidLoad
{
[super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
+
+ self.webView.allowsInlineMediaPlayback = YES;
+ self.webView.mediaPlaybackRequiresUserAction = NO;
+
+ NSURL *url = [NSURL URLWithString:@"http://www.youtube.com/watch?v=40rAtzemb-4"];
+ NSURLRequest *urlRequest = [[NSURLRequest alloc] initWithURL:url];
+
+ [self.webView loadRequest:urlRequest];
}
-- (void)didReceiveMemoryWarning
+- (void)webViewDidFinishLoad:(UIWebView *)webView
{
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
+ NSString *documentTitle = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
+
+ NSLog(@"documentTitle = '%@'", documentTitle);
}
@end
@@ -24,8 +24,6 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
- <key>UIMainStoryboardFile</key>
- <string>Main_iPhone</string>
<key>UIMainStoryboardFile~ipad</key>
<string>Main_iPad</string>
<key>UIRequiredDeviceCapabilities</key>
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4451" systemVersion="13A461" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
- <dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3676"/>
- </dependencies>
- <scenes>
- <!--class Prefix:identifier View Controller-->
- <scene sceneID="tne-QT-ifu">
- <objects>
- <viewController id="BYZ-38-t0r" customClass="APVViewController" sceneMemberID="viewController">
- <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
- <rect key="frame" x="0.0" y="20" width="768" height="1004"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
- </view>
- </viewController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
- </objects>
- </scene>
- </scenes>
- <simulatedMetricsContainer key="defaultSimulatedMetrics">
- <simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackOpaque"/>
- <simulatedOrientationMetrics key="orientation"/>
- <simulatedScreenMetrics key="destination"/>
- </simulatedMetricsContainer>
-</document>
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4451" systemVersion="13A461" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
- <dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3676"/>
- </dependencies>
- <scenes>
- <!--class Prefix:identifier View Controller-->
- <scene sceneID="ufC-wZ-h7g">
- <objects>
- <viewController id="vXZ-lx-hvc" customClass="APVViewController" sceneMemberID="viewController">
- <view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
- <rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
- <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
- </view>
- </viewController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
- </objects>
- </scene>
- </scenes>
- <simulatedMetricsContainer key="defaultSimulatedMetrics">
- <simulatedStatusBarMetrics key="statusBar"/>
- <simulatedOrientationMetrics key="orientation"/>
- <simulatedScreenMetrics key="destination" type="retina4"/>
- </simulatedMetricsContainer>
-</document>

0 comments on commit bf59858

Please sign in to comment.