Browse files

Added an example project (in MoreDemos folder) that provides a workar…

…ound for the problem with embedded Youtube videos when showed in a modally presented web view.
  • Loading branch information...
1 parent 29a518f commit d01c07037e2ddeae2c8d87040f8e4c4ce62c24f3 @tonisalae committed Mar 6, 2012
View
BIN .DS_Store
Binary file not shown.
View
332 MoreDemos/EmbeddedYoutubePatch/EmbeddedYoutubePatch.xcodeproj/project.pbxproj
@@ -0,0 +1,332 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 6FBF4B6314F7EACF0048C98E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6FBF4B6214F7EACF0048C98E /* UIKit.framework */; };
+ 6FBF4B6514F7EACF0048C98E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6FBF4B6414F7EACF0048C98E /* Foundation.framework */; };
+ 6FBF4B6714F7EACF0048C98E /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6FBF4B6614F7EACF0048C98E /* CoreGraphics.framework */; };
+ 6FBF4B6D14F7EACF0048C98E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6FBF4B6B14F7EACF0048C98E /* InfoPlist.strings */; };
+ 6FBF4B6F14F7EACF0048C98E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FBF4B6E14F7EACF0048C98E /* main.m */; };
+ 6FBF4B7314F7EACF0048C98E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FBF4B7214F7EACF0048C98E /* AppDelegate.m */; };
+ 6FBF4B7614F7EACF0048C98E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FBF4B7514F7EACF0048C98E /* ViewController.m */; };
+ 6FBF4B7914F7EACF0048C98E /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6FBF4B7714F7EACF0048C98E /* ViewController.xib */; };
+ 6FBF4B8A14F7EAF90048C98E /* back_icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 6FBF4B8114F7EAF90048C98E /* back_icon.png */; };
+ 6FBF4B8B14F7EAF90048C98E /* back_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6FBF4B8214F7EAF90048C98E /* back_icon@2x.png */; };
+ 6FBF4B8C14F7EAF90048C98E /* forward_icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 6FBF4B8314F7EAF90048C98E /* forward_icon.png */; };
+ 6FBF4B8D14F7EAF90048C98E /* forward_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6FBF4B8414F7EAF90048C98E /* forward_icon@2x.png */; };
+ 6FBF4B8E14F7EAF90048C98E /* reload_icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 6FBF4B8514F7EAF90048C98E /* reload_icon.png */; };
+ 6FBF4B8F14F7EAF90048C98E /* reload_icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6FBF4B8614F7EAF90048C98E /* reload_icon@2x.png */; };
+ 6FBF4B9014F7EAF90048C98E /* TSMiniWebBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FBF4B8814F7EAF90048C98E /* TSMiniWebBrowser.m */; };
+ 6FBF4B9114F7EAF90048C98E /* TSMiniWebBrowser.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6FBF4B8914F7EAF90048C98E /* TSMiniWebBrowser.xib */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 6FBF4B5E14F7EACF0048C98E /* EmbeddedYoutubePatch.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EmbeddedYoutubePatch.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 6FBF4B6214F7EACF0048C98E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 6FBF4B6414F7EACF0048C98E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 6FBF4B6614F7EACF0048C98E /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 6FBF4B6A14F7EACF0048C98E /* EmbeddedYoutubePatch-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "EmbeddedYoutubePatch-Info.plist"; sourceTree = "<group>"; };
+ 6FBF4B6C14F7EACF0048C98E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 6FBF4B6E14F7EACF0048C98E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 6FBF4B7014F7EACF0048C98E /* EmbeddedYoutubePatch-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "EmbeddedYoutubePatch-Prefix.pch"; sourceTree = "<group>"; };
+ 6FBF4B7114F7EACF0048C98E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 6FBF4B7214F7EACF0048C98E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 6FBF4B7414F7EACF0048C98E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
+ 6FBF4B7514F7EACF0048C98E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
+ 6FBF4B7814F7EACF0048C98E /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController.xib; sourceTree = "<group>"; };
+ 6FBF4B8114F7EAF90048C98E /* back_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = back_icon.png; sourceTree = "<group>"; };
+ 6FBF4B8214F7EAF90048C98E /* back_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "back_icon@2x.png"; sourceTree = "<group>"; };
+ 6FBF4B8314F7EAF90048C98E /* forward_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = forward_icon.png; sourceTree = "<group>"; };
+ 6FBF4B8414F7EAF90048C98E /* forward_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "forward_icon@2x.png"; sourceTree = "<group>"; };
+ 6FBF4B8514F7EAF90048C98E /* reload_icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = reload_icon.png; sourceTree = "<group>"; };
+ 6FBF4B8614F7EAF90048C98E /* reload_icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "reload_icon@2x.png"; sourceTree = "<group>"; };
+ 6FBF4B8714F7EAF90048C98E /* TSMiniWebBrowser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSMiniWebBrowser.h; sourceTree = "<group>"; };
+ 6FBF4B8814F7EAF90048C98E /* TSMiniWebBrowser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSMiniWebBrowser.m; sourceTree = "<group>"; };
+ 6FBF4B8914F7EAF90048C98E /* TSMiniWebBrowser.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TSMiniWebBrowser.xib; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 6FBF4B5B14F7EACF0048C98E /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6FBF4B6314F7EACF0048C98E /* UIKit.framework in Frameworks */,
+ 6FBF4B6514F7EACF0048C98E /* Foundation.framework in Frameworks */,
+ 6FBF4B6714F7EACF0048C98E /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 6FBF4B5314F7EACF0048C98E = {
+ isa = PBXGroup;
+ children = (
+ 6FBF4B6814F7EACF0048C98E /* EmbeddedYoutubePatch */,
+ 6FBF4B6114F7EACF0048C98E /* Frameworks */,
+ 6FBF4B5F14F7EACF0048C98E /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 6FBF4B5F14F7EACF0048C98E /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 6FBF4B5E14F7EACF0048C98E /* EmbeddedYoutubePatch.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 6FBF4B6114F7EACF0048C98E /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 6FBF4B6214F7EACF0048C98E /* UIKit.framework */,
+ 6FBF4B6414F7EACF0048C98E /* Foundation.framework */,
+ 6FBF4B6614F7EACF0048C98E /* CoreGraphics.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 6FBF4B6814F7EACF0048C98E /* EmbeddedYoutubePatch */ = {
+ isa = PBXGroup;
+ children = (
+ 6FBF4B7F14F7EAF90048C98E /* TSMiniWebBrowser */,
+ 6FBF4B7114F7EACF0048C98E /* AppDelegate.h */,
+ 6FBF4B7214F7EACF0048C98E /* AppDelegate.m */,
+ 6FBF4B7414F7EACF0048C98E /* ViewController.h */,
+ 6FBF4B7514F7EACF0048C98E /* ViewController.m */,
+ 6FBF4B7714F7EACF0048C98E /* ViewController.xib */,
+ 6FBF4B6914F7EACF0048C98E /* Supporting Files */,
+ );
+ path = EmbeddedYoutubePatch;
+ sourceTree = "<group>";
+ };
+ 6FBF4B6914F7EACF0048C98E /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 6FBF4B6A14F7EACF0048C98E /* EmbeddedYoutubePatch-Info.plist */,
+ 6FBF4B6B14F7EACF0048C98E /* InfoPlist.strings */,
+ 6FBF4B6E14F7EACF0048C98E /* main.m */,
+ 6FBF4B7014F7EACF0048C98E /* EmbeddedYoutubePatch-Prefix.pch */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 6FBF4B7F14F7EAF90048C98E /* TSMiniWebBrowser */ = {
+ isa = PBXGroup;
+ children = (
+ 6FBF4B8014F7EAF90048C98E /* images */,
+ 6FBF4B8714F7EAF90048C98E /* TSMiniWebBrowser.h */,
+ 6FBF4B8814F7EAF90048C98E /* TSMiniWebBrowser.m */,
+ 6FBF4B8914F7EAF90048C98E /* TSMiniWebBrowser.xib */,
+ );
+ name = TSMiniWebBrowser;
+ path = ../../../TSMiniWebBrowser;
+ sourceTree = "<group>";
+ };
+ 6FBF4B8014F7EAF90048C98E /* images */ = {
+ isa = PBXGroup;
+ children = (
+ 6FBF4B8114F7EAF90048C98E /* back_icon.png */,
+ 6FBF4B8214F7EAF90048C98E /* back_icon@2x.png */,
+ 6FBF4B8314F7EAF90048C98E /* forward_icon.png */,
+ 6FBF4B8414F7EAF90048C98E /* forward_icon@2x.png */,
+ 6FBF4B8514F7EAF90048C98E /* reload_icon.png */,
+ 6FBF4B8614F7EAF90048C98E /* reload_icon@2x.png */,
+ );
+ path = images;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 6FBF4B5D14F7EACF0048C98E /* EmbeddedYoutubePatch */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 6FBF4B7C14F7EACF0048C98E /* Build configuration list for PBXNativeTarget "EmbeddedYoutubePatch" */;
+ buildPhases = (
+ 6FBF4B5A14F7EACF0048C98E /* Sources */,
+ 6FBF4B5B14F7EACF0048C98E /* Frameworks */,
+ 6FBF4B5C14F7EACF0048C98E /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = EmbeddedYoutubePatch;
+ productName = EmbeddedYoutubePatch;
+ productReference = 6FBF4B5E14F7EACF0048C98E /* EmbeddedYoutubePatch.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 6FBF4B5514F7EACF0048C98E /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0420;
+ };
+ buildConfigurationList = 6FBF4B5814F7EACF0048C98E /* Build configuration list for PBXProject "EmbeddedYoutubePatch" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 6FBF4B5314F7EACF0048C98E;
+ productRefGroup = 6FBF4B5F14F7EACF0048C98E /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 6FBF4B5D14F7EACF0048C98E /* EmbeddedYoutubePatch */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 6FBF4B5C14F7EACF0048C98E /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6FBF4B6D14F7EACF0048C98E /* InfoPlist.strings in Resources */,
+ 6FBF4B7914F7EACF0048C98E /* ViewController.xib in Resources */,
+ 6FBF4B8A14F7EAF90048C98E /* back_icon.png in Resources */,
+ 6FBF4B8B14F7EAF90048C98E /* back_icon@2x.png in Resources */,
+ 6FBF4B8C14F7EAF90048C98E /* forward_icon.png in Resources */,
+ 6FBF4B8D14F7EAF90048C98E /* forward_icon@2x.png in Resources */,
+ 6FBF4B8E14F7EAF90048C98E /* reload_icon.png in Resources */,
+ 6FBF4B8F14F7EAF90048C98E /* reload_icon@2x.png in Resources */,
+ 6FBF4B9114F7EAF90048C98E /* TSMiniWebBrowser.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 6FBF4B5A14F7EACF0048C98E /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6FBF4B6F14F7EACF0048C98E /* main.m in Sources */,
+ 6FBF4B7314F7EACF0048C98E /* AppDelegate.m in Sources */,
+ 6FBF4B7614F7EACF0048C98E /* ViewController.m in Sources */,
+ 6FBF4B9014F7EAF90048C98E /* TSMiniWebBrowser.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 6FBF4B6B14F7EACF0048C98E /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 6FBF4B6C14F7EACF0048C98E /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+ 6FBF4B7714F7EACF0048C98E /* ViewController.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 6FBF4B7814F7EACF0048C98E /* en */,
+ );
+ name = ViewController.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 6FBF4B7A14F7EACF0048C98E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ 6FBF4B7B14F7EACF0048C98E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 6FBF4B7D14F7EACF0048C98E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "EmbeddedYoutubePatch/EmbeddedYoutubePatch-Prefix.pch";
+ INFOPLIST_FILE = "EmbeddedYoutubePatch/EmbeddedYoutubePatch-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ 6FBF4B7E14F7EACF0048C98E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "EmbeddedYoutubePatch/EmbeddedYoutubePatch-Prefix.pch";
+ INFOPLIST_FILE = "EmbeddedYoutubePatch/EmbeddedYoutubePatch-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 6FBF4B5814F7EACF0048C98E /* Build configuration list for PBXProject "EmbeddedYoutubePatch" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 6FBF4B7A14F7EACF0048C98E /* Debug */,
+ 6FBF4B7B14F7EACF0048C98E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 6FBF4B7C14F7EACF0048C98E /* Build configuration list for PBXNativeTarget "EmbeddedYoutubePatch" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 6FBF4B7D14F7EACF0048C98E /* Debug */,
+ 6FBF4B7E14F7EACF0048C98E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 6FBF4B5514F7EACF0048C98E /* Project object */;
+}
View
7 ...dYoutubePatch/EmbeddedYoutubePatch.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:EmbeddedYoutubePatch.xcodeproj">
+ </FileRef>
+</Workspace>
View
19 MoreDemos/EmbeddedYoutubePatch/EmbeddedYoutubePatch/AppDelegate.h
@@ -0,0 +1,19 @@
+//
+// AppDelegate.h
+// EmbeddedYoutubePatch
+//
+// Created by Toni Sala Echaurren on 24/02/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class ViewController;
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+@property (strong, nonatomic) ViewController *viewController;
+
+@end
View
67 MoreDemos/EmbeddedYoutubePatch/EmbeddedYoutubePatch/AppDelegate.m
@@ -0,0 +1,67 @@
+//
+// AppDelegate.m
+// EmbeddedYoutubePatch
+//
+// Created by Toni Sala Echaurren on 24/02/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "AppDelegate.h"
+
+#import "ViewController.h"
+
+@implementation AppDelegate
+
+@synthesize window = _window;
+@synthesize viewController = _viewController;
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ // Override point for customization after application launch.
+ self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
+ self.window.rootViewController = self.viewController;
+ [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
View
40 MoreDemos/EmbeddedYoutubePatch/EmbeddedYoutubePatch/EmbeddedYoutubePatch-Info.plist
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFiles</key>
+ <array/>
+ <key>CFBundleIdentifier</key>
+ <string>com.tonisalae.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
View
14 MoreDemos/EmbeddedYoutubePatch/EmbeddedYoutubePatch/EmbeddedYoutubePatch-Prefix.pch
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'EmbeddedYoutubePatch' target in the 'EmbeddedYoutubePatch' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_4_0
+#warning "This project uses features only available in iOS SDK 4.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
View
20 MoreDemos/EmbeddedYoutubePatch/EmbeddedYoutubePatch/ViewController.h
@@ -0,0 +1,20 @@
+//
+// ViewController.h
+// EmbeddedYoutubePatch
+//
+// Created by Toni Sala Echaurren on 24/02/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "TSMiniWebBrowser.h"
+
+@interface ViewController : UIViewController <TSMiniWebBrowserDelegate> {
+ TSMiniWebBrowser *webViewController;
+}
+
+@property (nonatomic, assign) BOOL modalWebViewPresented;
+
+- (IBAction)buttonTouchUp:(id)sender;
+
+@end
View
101 MoreDemos/EmbeddedYoutubePatch/EmbeddedYoutubePatch/ViewController.m
@@ -0,0 +1,101 @@
+//
+// ViewController.m
+// EmbeddedYoutubePatch
+//
+// Created by Toni Sala Echaurren on 24/02/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "ViewController.h"
+
+@implementation ViewController
+@synthesize modalWebViewPresented;
+
+#pragma mark - Embeeded Youtube video patch
+
+/*
+ * These 3 methods allow a workaround to the problem of embedded youtube videos when presented modally in a web view.
+ * More details here: http://stackoverflow.com/questions/8419145/playing-youtube-video-inside-uiwebview-how-to-handle-the-done-button/9129304#9129304
+ */
+
+- (void) presentModalWebViewController:(BOOL) animated {
+ // Create webViewController here.
+ [self presentModalViewController:webViewController animated:animated];
+ self.modalWebViewPresented = YES;
+}
+
+- (void) dismissModalWebViewController:(BOOL) animated {
+ self.modalWebViewPresented = NO;
+ [self dismissModalViewControllerAnimated:animated];
+}
+
+- (void) viewDidAppear:(BOOL)animated {
+ [super viewDidAppear:animated];
+ if (self.modalWebViewPresented) {
+ // Note: iOS thinks the previous modal view controller is displayed.
+ // It must be dismissed first before a new one can be displayed.
+ // No animation is needed as the YouTube plugin already provides some.
+ [self dismissModalWebViewController:NO];
+ [self presentModalWebViewController:NO];
+ }
+}
+
+#pragma mark - TSMiniWebBrowserDelegate
+
+-(void) tsMiniWebBrowserDidDismiss {
+ NSLog(@"browser dismissed");
+ [self dismissModalWebViewController:YES]; // IMPORTANT!!!!!!
+}
+
+#pragma mark - View lifecycle
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning];
+ // Release any cached data, images, etc that aren't in use.
+}
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+ // Do any additional setup after loading the view, typically from a nib.
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+ // Release any retained subviews of the main view.
+ // e.g. self.myOutlet = nil;
+}
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [super viewWillAppear:animated];
+}
+
+- (void)viewWillDisappear:(BOOL)animated
+{
+ [super viewWillDisappear:animated];
+}
+
+- (void)viewDidDisappear:(BOOL)animated
+{
+ [super viewDidDisappear:animated];
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ // Return YES for supported orientations
+ return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
+}
+
+#pragma mark - Actions
+
+- (IBAction)buttonTouchUp:(id)sender {
+ webViewController = [[TSMiniWebBrowser alloc] initWithUrl:[NSURL URLWithString:@"http://www.xrel.to/movie/72308/Black-Gold.html#video=_KLQjS7egS4"]];
+ webViewController.mode = TSMiniWebBrowserModeModal;
+ webViewController.delegate = self;
+ [self presentModalWebViewController:YES];
+}
+
+@end
View
2 MoreDemos/EmbeddedYoutubePatch/EmbeddedYoutubePatch/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
View
164 MoreDemos/EmbeddedYoutubePatch/EmbeddedYoutubePatch/en.lproj/ViewController.xib
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
+ <data>
+ <int key="IBDocument.SystemTarget">1280</int>
+ <string key="IBDocument.SystemVersion">11D50b</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1938</string>
+ <string key="IBDocument.AppKitVersion">1138.32</string>
+ <string key="IBDocument.HIToolboxVersion">568.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">933</string>
+ </object>
+ <array key="IBDocument.IntegratedClassDependencies">
+ <string>IBProxyObject</string>
+ <string>IBUIView</string>
+ <string>IBUIButton</string>
+ </array>
+ <array key="IBDocument.PluginDependencies">
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </array>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="843779117">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIView" id="774585933">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="IBUIButton" id="724706112">
+ <reference key="NSNextResponder" ref="774585933"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{77, 211}, {166, 37}}</string>
+ <reference key="NSSuperview" ref="774585933"/>
+ <reference key="NSNextKeyView"/>
+ <string key="NSReuseIdentifierKey">_NS:225</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">TSMiniWebBrowser</string>
+ <object class="NSColor" key="IBUIHighlightedTitleColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleShadowColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ <object class="IBUIFontDescription" key="IBUIFontDescription">
+ <int key="type">2</int>
+ <double key="pointSize">15</double>
+ </object>
+ <object class="NSFont" key="IBUIFont">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">15</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ </object>
+ </array>
+ <string key="NSFrame">{{0, 20}, {320, 460}}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSNextKeyView" ref="724706112"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC43NQA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace">
+ <int key="NSID">2</int>
+ </object>
+ </object>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </array>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <array class="NSMutableArray" key="connectionRecords">
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="774585933"/>
+ </object>
+ <int key="connectionID">7</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">buttonTouchUp:</string>
+ <reference key="source" ref="724706112"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">9</int>
+ </object>
+ </array>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <array key="orderedObjects">
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <array key="object" id="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="843779117"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6</int>
+ <reference key="object" ref="774585933"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="724706112"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">8</int>
+ <reference key="object" ref="724706112"/>
+ <reference key="parent" ref="774585933"/>
+ </object>
+ </array>
+ </object>
+ <dictionary class="NSMutableDictionary" key="flattenedProperties">
+ <string key="-1.CustomClassName">ViewController</string>
+ <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="-2.CustomClassName">UIResponder</string>
+ <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
+ <nil key="activeLocalization"/>
+ <dictionary class="NSMutableDictionary" key="localizations"/>
+ <nil key="sourceID"/>
+ <int key="maxID">9</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes"/>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">933</string>
+ </data>
+</archive>
View
18 MoreDemos/EmbeddedYoutubePatch/EmbeddedYoutubePatch/main.m
@@ -0,0 +1,18 @@
+//
+// main.m
+// EmbeddedYoutubePatch
+//
+// Created by Toni Sala Echaurren on 24/02/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import "AppDelegate.h"
+
+int main(int argc, char *argv[])
+{
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}
View
3 MoreDemos/EmbeddedYoutubePatch/README.txt
@@ -0,0 +1,3 @@
+This example provides a workaround for the problem with embedded Youtube videos when showed in a modally presented web view.
+
+More details here: http://stackoverflow.com/questions/8419145/playing-youtube-video-inside-uiwebview-how-to-handle-the-done-button/9129304#9129304

0 comments on commit d01c070

Please sign in to comment.