├── .gitignore ├── Example ├── JBWebViewController.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── JBWebViewController.xccheckout │ └── xcuserdata │ │ └── jonasboserup.xcuserdatad │ │ └── xcschemes │ │ ├── JBWebViewController.xcscheme │ │ └── xcschememanagement.plist ├── JBWebViewController │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── JBWebViewControllerTests │ ├── Info.plist │ └── JBWebViewControllerTests.m ├── Podfile └── screenshot.png ├── JBWebViewController.podspec ├── JBWebViewController ├── Icons.xcassets │ ├── Back.imageset │ │ ├── Contents.json │ │ ├── back-25.png │ │ ├── back-50.png │ │ └── back-75.png │ ├── Dismiss.imageset │ │ ├── Contents.json │ │ ├── dismiss-25.png │ │ ├── dismiss-50.png │ │ └── dismiss-75.png │ ├── Forward.imageset │ │ ├── Contents.json │ │ ├── forward-25.png │ │ ├── forward-50.png │ │ └── forward-75.png │ └── Share.imageset │ │ ├── Contents.json │ │ ├── share-25.png │ │ ├── share-50.png │ │ └── share-75.png ├── JBWebViewController.h └── JBWebViewController.m ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.swp 3 | *~.nib 4 | 5 | build/ 6 | 7 | *.pbxuser 8 | *.perspective 9 | *.perspectivev3 10 | *.mode1v3 11 | *.mode2v3 12 | *.xcuserdata 13 | *.xcuserstate 14 | -------------------------------------------------------------------------------- /Example/JBWebViewController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 395395B8CFF99794280F967F /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 211625572CB09236AECD540F /* libPods.a */; }; 11 | 3DB09FF31A002AEE00C2A6FF /* Icons.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3DB09FF21A002AEE00C2A6FF /* Icons.xcassets */; }; 12 | 3DCC249F1A000151005B9669 /* JBWebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DCC249E1A000151005B9669 /* JBWebViewController.m */; }; 13 | 3DCC24A11A0001C4005B9669 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DCC24A01A0001C4005B9669 /* WebKit.framework */; }; 14 | 3DCC470E19FFDD54006620A0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DCC470D19FFDD54006620A0 /* main.m */; }; 15 | 3DCC471119FFDD54006620A0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DCC471019FFDD54006620A0 /* AppDelegate.m */; }; 16 | 3DCC471419FFDD54006620A0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DCC471319FFDD54006620A0 /* ViewController.m */; }; 17 | 3DCC471719FFDD54006620A0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3DCC471519FFDD54006620A0 /* Main.storyboard */; }; 18 | 3DCC471919FFDD54006620A0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3DCC471819FFDD54006620A0 /* Images.xcassets */; }; 19 | 3DCC471C19FFDD54006620A0 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3DCC471A19FFDD54006620A0 /* LaunchScreen.xib */; }; 20 | 3DCC472819FFDD54006620A0 /* JBWebViewControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DCC472719FFDD54006620A0 /* JBWebViewControllerTests.m */; }; 21 | 3DE8B55C1A02596700F02F0E /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DE8B55B1A02596700F02F0E /* CoreGraphics.framework */; }; 22 | 3DE8B55E1A02597900F02F0E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DE8B55D1A02597900F02F0E /* Foundation.framework */; }; 23 | 3DE8B5601A02597E00F02F0E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DE8B55F1A02597E00F02F0E /* UIKit.framework */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | 3DCC472219FFDD54006620A0 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = 3DCC470019FFDD54006620A0 /* Project object */; 30 | proxyType = 1; 31 | remoteGlobalIDString = 3DCC470719FFDD54006620A0; 32 | remoteInfo = JBWebViewController; 33 | }; 34 | /* End PBXContainerItemProxy section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | 211625572CB09236AECD540F /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 3DB09FF21A002AEE00C2A6FF /* Icons.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Icons.xcassets; sourceTree = ""; }; 39 | 3DCC249D1A000151005B9669 /* JBWebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JBWebViewController.h; sourceTree = ""; }; 40 | 3DCC249E1A000151005B9669 /* JBWebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JBWebViewController.m; sourceTree = ""; }; 41 | 3DCC24A01A0001C4005B9669 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; 42 | 3DCC470819FFDD54006620A0 /* JBWebViewController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JBWebViewController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 3DCC470C19FFDD54006620A0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 3DCC470D19FFDD54006620A0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 45 | 3DCC470F19FFDD54006620A0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 3DCC471019FFDD54006620A0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 3DCC471219FFDD54006620A0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 48 | 3DCC471319FFDD54006620A0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 49 | 3DCC471619FFDD54006620A0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 3DCC471819FFDD54006620A0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 51 | 3DCC471B19FFDD54006620A0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 52 | 3DCC472119FFDD54006620A0 /* JBWebViewControllerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JBWebViewControllerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 3DCC472619FFDD54006620A0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 3DCC472719FFDD54006620A0 /* JBWebViewControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JBWebViewControllerTests.m; sourceTree = ""; }; 55 | 3DE8B55B1A02596700F02F0E /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 56 | 3DE8B55D1A02597900F02F0E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 57 | 3DE8B55F1A02597E00F02F0E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 58 | 4D498A22AFCCEC53F622EF17 /* Pods-JBWebViewController.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JBWebViewController.release.xcconfig"; path = "Pods/Target Support Files/Pods-JBWebViewController/Pods-JBWebViewController.release.xcconfig"; sourceTree = ""; }; 59 | 76C5896B2C32AD4C9E57974B /* libPods-JBWebViewController.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-JBWebViewController.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 60 | 928C1BC73E1497152F46199B /* Pods-JBWebViewController.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JBWebViewController.debug.xcconfig"; path = "Pods/Target Support Files/Pods-JBWebViewController/Pods-JBWebViewController.debug.xcconfig"; sourceTree = ""; }; 61 | ACC8AADF9FCFEA16F95C3932 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; 62 | C304122CA3ACA4DD351ACBB5 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 3DCC470519FFDD54006620A0 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | 3DE8B5601A02597E00F02F0E /* UIKit.framework in Frameworks */, 71 | 3DE8B55E1A02597900F02F0E /* Foundation.framework in Frameworks */, 72 | 3DE8B55C1A02596700F02F0E /* CoreGraphics.framework in Frameworks */, 73 | 3DCC24A11A0001C4005B9669 /* WebKit.framework in Frameworks */, 74 | 395395B8CFF99794280F967F /* libPods.a in Frameworks */, 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | 3DCC471E19FFDD54006620A0 /* Frameworks */ = { 79 | isa = PBXFrameworksBuildPhase; 80 | buildActionMask = 2147483647; 81 | files = ( 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | /* End PBXFrameworksBuildPhase section */ 86 | 87 | /* Begin PBXGroup section */ 88 | 0E457DDD4553DD75D5BC4F0E /* Pods */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 928C1BC73E1497152F46199B /* Pods-JBWebViewController.debug.xcconfig */, 92 | 4D498A22AFCCEC53F622EF17 /* Pods-JBWebViewController.release.xcconfig */, 93 | C304122CA3ACA4DD351ACBB5 /* Pods.debug.xcconfig */, 94 | ACC8AADF9FCFEA16F95C3932 /* Pods.release.xcconfig */, 95 | ); 96 | name = Pods; 97 | sourceTree = ""; 98 | }; 99 | 2B7ED32A3264CCD1512BAF00 /* Frameworks */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 3DE8B55F1A02597E00F02F0E /* UIKit.framework */, 103 | 3DE8B55D1A02597900F02F0E /* Foundation.framework */, 104 | 3DE8B55B1A02596700F02F0E /* CoreGraphics.framework */, 105 | 76C5896B2C32AD4C9E57974B /* libPods-JBWebViewController.a */, 106 | 211625572CB09236AECD540F /* libPods.a */, 107 | ); 108 | name = Frameworks; 109 | sourceTree = ""; 110 | }; 111 | 3DCC249C1A000151005B9669 /* JBWebViewController */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 3DCC249D1A000151005B9669 /* JBWebViewController.h */, 115 | 3DCC249E1A000151005B9669 /* JBWebViewController.m */, 116 | 3DB09FF21A002AEE00C2A6FF /* Icons.xcassets */, 117 | ); 118 | name = JBWebViewController; 119 | path = ../../JBWebViewController; 120 | sourceTree = ""; 121 | }; 122 | 3DCC46FF19FFDD54006620A0 = { 123 | isa = PBXGroup; 124 | children = ( 125 | 3DCC24A01A0001C4005B9669 /* WebKit.framework */, 126 | 3DCC470A19FFDD54006620A0 /* JBWebViewController */, 127 | 3DCC472419FFDD54006620A0 /* JBWebViewControllerTests */, 128 | 3DCC470919FFDD54006620A0 /* Products */, 129 | 0E457DDD4553DD75D5BC4F0E /* Pods */, 130 | 2B7ED32A3264CCD1512BAF00 /* Frameworks */, 131 | ); 132 | sourceTree = ""; 133 | }; 134 | 3DCC470919FFDD54006620A0 /* Products */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 3DCC470819FFDD54006620A0 /* JBWebViewController.app */, 138 | 3DCC472119FFDD54006620A0 /* JBWebViewControllerTests.xctest */, 139 | ); 140 | name = Products; 141 | sourceTree = ""; 142 | }; 143 | 3DCC470A19FFDD54006620A0 /* JBWebViewController */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | 3DCC249C1A000151005B9669 /* JBWebViewController */, 147 | 3DCC470F19FFDD54006620A0 /* AppDelegate.h */, 148 | 3DCC471019FFDD54006620A0 /* AppDelegate.m */, 149 | 3DCC471219FFDD54006620A0 /* ViewController.h */, 150 | 3DCC471319FFDD54006620A0 /* ViewController.m */, 151 | 3DCC471519FFDD54006620A0 /* Main.storyboard */, 152 | 3DCC471819FFDD54006620A0 /* Images.xcassets */, 153 | 3DCC471A19FFDD54006620A0 /* LaunchScreen.xib */, 154 | 3DCC470B19FFDD54006620A0 /* Supporting Files */, 155 | ); 156 | path = JBWebViewController; 157 | sourceTree = ""; 158 | }; 159 | 3DCC470B19FFDD54006620A0 /* Supporting Files */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 3DCC470C19FFDD54006620A0 /* Info.plist */, 163 | 3DCC470D19FFDD54006620A0 /* main.m */, 164 | ); 165 | name = "Supporting Files"; 166 | sourceTree = ""; 167 | }; 168 | 3DCC472419FFDD54006620A0 /* JBWebViewControllerTests */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | 3DCC472719FFDD54006620A0 /* JBWebViewControllerTests.m */, 172 | 3DCC472519FFDD54006620A0 /* Supporting Files */, 173 | ); 174 | path = JBWebViewControllerTests; 175 | sourceTree = ""; 176 | }; 177 | 3DCC472519FFDD54006620A0 /* Supporting Files */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | 3DCC472619FFDD54006620A0 /* Info.plist */, 181 | ); 182 | name = "Supporting Files"; 183 | sourceTree = ""; 184 | }; 185 | /* End PBXGroup section */ 186 | 187 | /* Begin PBXNativeTarget section */ 188 | 3DCC470719FFDD54006620A0 /* JBWebViewController */ = { 189 | isa = PBXNativeTarget; 190 | buildConfigurationList = 3DCC472B19FFDD54006620A0 /* Build configuration list for PBXNativeTarget "JBWebViewController" */; 191 | buildPhases = ( 192 | A46F10D54481BC8D9384B9CC /* Check Pods Manifest.lock */, 193 | 3DCC470419FFDD54006620A0 /* Sources */, 194 | 3DCC470519FFDD54006620A0 /* Frameworks */, 195 | 3DCC470619FFDD54006620A0 /* Resources */, 196 | C4B031E926B7B819DFA4F6AA /* Copy Pods Resources */, 197 | ); 198 | buildRules = ( 199 | ); 200 | dependencies = ( 201 | ); 202 | name = JBWebViewController; 203 | productName = JBWebViewController; 204 | productReference = 3DCC470819FFDD54006620A0 /* JBWebViewController.app */; 205 | productType = "com.apple.product-type.application"; 206 | }; 207 | 3DCC472019FFDD54006620A0 /* JBWebViewControllerTests */ = { 208 | isa = PBXNativeTarget; 209 | buildConfigurationList = 3DCC472E19FFDD54006620A0 /* Build configuration list for PBXNativeTarget "JBWebViewControllerTests" */; 210 | buildPhases = ( 211 | 3DCC471D19FFDD54006620A0 /* Sources */, 212 | 3DCC471E19FFDD54006620A0 /* Frameworks */, 213 | 3DCC471F19FFDD54006620A0 /* Resources */, 214 | ); 215 | buildRules = ( 216 | ); 217 | dependencies = ( 218 | 3DCC472319FFDD54006620A0 /* PBXTargetDependency */, 219 | ); 220 | name = JBWebViewControllerTests; 221 | productName = JBWebViewControllerTests; 222 | productReference = 3DCC472119FFDD54006620A0 /* JBWebViewControllerTests.xctest */; 223 | productType = "com.apple.product-type.bundle.unit-test"; 224 | }; 225 | /* End PBXNativeTarget section */ 226 | 227 | /* Begin PBXProject section */ 228 | 3DCC470019FFDD54006620A0 /* Project object */ = { 229 | isa = PBXProject; 230 | attributes = { 231 | LastUpgradeCheck = 0610; 232 | ORGANIZATIONNAME = "Jonas Boserup"; 233 | TargetAttributes = { 234 | 3DCC470719FFDD54006620A0 = { 235 | CreatedOnToolsVersion = 6.1; 236 | }; 237 | 3DCC472019FFDD54006620A0 = { 238 | CreatedOnToolsVersion = 6.1; 239 | TestTargetID = 3DCC470719FFDD54006620A0; 240 | }; 241 | }; 242 | }; 243 | buildConfigurationList = 3DCC470319FFDD54006620A0 /* Build configuration list for PBXProject "JBWebViewController" */; 244 | compatibilityVersion = "Xcode 3.2"; 245 | developmentRegion = English; 246 | hasScannedForEncodings = 0; 247 | knownRegions = ( 248 | en, 249 | Base, 250 | ); 251 | mainGroup = 3DCC46FF19FFDD54006620A0; 252 | productRefGroup = 3DCC470919FFDD54006620A0 /* Products */; 253 | projectDirPath = ""; 254 | projectRoot = ""; 255 | targets = ( 256 | 3DCC470719FFDD54006620A0 /* JBWebViewController */, 257 | 3DCC472019FFDD54006620A0 /* JBWebViewControllerTests */, 258 | ); 259 | }; 260 | /* End PBXProject section */ 261 | 262 | /* Begin PBXResourcesBuildPhase section */ 263 | 3DCC470619FFDD54006620A0 /* Resources */ = { 264 | isa = PBXResourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | 3DCC471719FFDD54006620A0 /* Main.storyboard in Resources */, 268 | 3DCC471C19FFDD54006620A0 /* LaunchScreen.xib in Resources */, 269 | 3DB09FF31A002AEE00C2A6FF /* Icons.xcassets in Resources */, 270 | 3DCC471919FFDD54006620A0 /* Images.xcassets in Resources */, 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | }; 274 | 3DCC471F19FFDD54006620A0 /* Resources */ = { 275 | isa = PBXResourcesBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | ); 279 | runOnlyForDeploymentPostprocessing = 0; 280 | }; 281 | /* End PBXResourcesBuildPhase section */ 282 | 283 | /* Begin PBXShellScriptBuildPhase section */ 284 | A46F10D54481BC8D9384B9CC /* Check Pods Manifest.lock */ = { 285 | isa = PBXShellScriptBuildPhase; 286 | buildActionMask = 2147483647; 287 | files = ( 288 | ); 289 | inputPaths = ( 290 | ); 291 | name = "Check Pods Manifest.lock"; 292 | outputPaths = ( 293 | ); 294 | runOnlyForDeploymentPostprocessing = 0; 295 | shellPath = /bin/sh; 296 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 297 | showEnvVarsInLog = 0; 298 | }; 299 | C4B031E926B7B819DFA4F6AA /* Copy Pods Resources */ = { 300 | isa = PBXShellScriptBuildPhase; 301 | buildActionMask = 2147483647; 302 | files = ( 303 | ); 304 | inputPaths = ( 305 | ); 306 | name = "Copy Pods Resources"; 307 | outputPaths = ( 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | shellPath = /bin/sh; 311 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; 312 | showEnvVarsInLog = 0; 313 | }; 314 | /* End PBXShellScriptBuildPhase section */ 315 | 316 | /* Begin PBXSourcesBuildPhase section */ 317 | 3DCC470419FFDD54006620A0 /* Sources */ = { 318 | isa = PBXSourcesBuildPhase; 319 | buildActionMask = 2147483647; 320 | files = ( 321 | 3DCC471419FFDD54006620A0 /* ViewController.m in Sources */, 322 | 3DCC249F1A000151005B9669 /* JBWebViewController.m in Sources */, 323 | 3DCC471119FFDD54006620A0 /* AppDelegate.m in Sources */, 324 | 3DCC470E19FFDD54006620A0 /* main.m in Sources */, 325 | ); 326 | runOnlyForDeploymentPostprocessing = 0; 327 | }; 328 | 3DCC471D19FFDD54006620A0 /* Sources */ = { 329 | isa = PBXSourcesBuildPhase; 330 | buildActionMask = 2147483647; 331 | files = ( 332 | 3DCC472819FFDD54006620A0 /* JBWebViewControllerTests.m in Sources */, 333 | ); 334 | runOnlyForDeploymentPostprocessing = 0; 335 | }; 336 | /* End PBXSourcesBuildPhase section */ 337 | 338 | /* Begin PBXTargetDependency section */ 339 | 3DCC472319FFDD54006620A0 /* PBXTargetDependency */ = { 340 | isa = PBXTargetDependency; 341 | target = 3DCC470719FFDD54006620A0 /* JBWebViewController */; 342 | targetProxy = 3DCC472219FFDD54006620A0 /* PBXContainerItemProxy */; 343 | }; 344 | /* End PBXTargetDependency section */ 345 | 346 | /* Begin PBXVariantGroup section */ 347 | 3DCC471519FFDD54006620A0 /* Main.storyboard */ = { 348 | isa = PBXVariantGroup; 349 | children = ( 350 | 3DCC471619FFDD54006620A0 /* Base */, 351 | ); 352 | name = Main.storyboard; 353 | sourceTree = ""; 354 | }; 355 | 3DCC471A19FFDD54006620A0 /* LaunchScreen.xib */ = { 356 | isa = PBXVariantGroup; 357 | children = ( 358 | 3DCC471B19FFDD54006620A0 /* Base */, 359 | ); 360 | name = LaunchScreen.xib; 361 | sourceTree = ""; 362 | }; 363 | /* End PBXVariantGroup section */ 364 | 365 | /* Begin XCBuildConfiguration section */ 366 | 3DCC472919FFDD54006620A0 /* Debug */ = { 367 | isa = XCBuildConfiguration; 368 | buildSettings = { 369 | ALWAYS_SEARCH_USER_PATHS = NO; 370 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 371 | CLANG_CXX_LIBRARY = "libc++"; 372 | CLANG_ENABLE_MODULES = YES; 373 | CLANG_ENABLE_OBJC_ARC = YES; 374 | CLANG_WARN_BOOL_CONVERSION = YES; 375 | CLANG_WARN_CONSTANT_CONVERSION = YES; 376 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 377 | CLANG_WARN_EMPTY_BODY = YES; 378 | CLANG_WARN_ENUM_CONVERSION = YES; 379 | CLANG_WARN_INT_CONVERSION = YES; 380 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 381 | CLANG_WARN_UNREACHABLE_CODE = YES; 382 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 383 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 384 | COPY_PHASE_STRIP = NO; 385 | ENABLE_STRICT_OBJC_MSGSEND = YES; 386 | GCC_C_LANGUAGE_STANDARD = gnu99; 387 | GCC_DYNAMIC_NO_PIC = NO; 388 | GCC_OPTIMIZATION_LEVEL = 0; 389 | GCC_PREPROCESSOR_DEFINITIONS = ( 390 | "DEBUG=1", 391 | "$(inherited)", 392 | ); 393 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 394 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 395 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 396 | GCC_WARN_UNDECLARED_SELECTOR = YES; 397 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 398 | GCC_WARN_UNUSED_FUNCTION = YES; 399 | GCC_WARN_UNUSED_VARIABLE = YES; 400 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 401 | MTL_ENABLE_DEBUG_INFO = YES; 402 | ONLY_ACTIVE_ARCH = YES; 403 | SDKROOT = iphoneos; 404 | TARGETED_DEVICE_FAMILY = "1,2"; 405 | }; 406 | name = Debug; 407 | }; 408 | 3DCC472A19FFDD54006620A0 /* Release */ = { 409 | isa = XCBuildConfiguration; 410 | buildSettings = { 411 | ALWAYS_SEARCH_USER_PATHS = NO; 412 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 413 | CLANG_CXX_LIBRARY = "libc++"; 414 | CLANG_ENABLE_MODULES = YES; 415 | CLANG_ENABLE_OBJC_ARC = YES; 416 | CLANG_WARN_BOOL_CONVERSION = YES; 417 | CLANG_WARN_CONSTANT_CONVERSION = YES; 418 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 419 | CLANG_WARN_EMPTY_BODY = YES; 420 | CLANG_WARN_ENUM_CONVERSION = YES; 421 | CLANG_WARN_INT_CONVERSION = YES; 422 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 423 | CLANG_WARN_UNREACHABLE_CODE = YES; 424 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 425 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 426 | COPY_PHASE_STRIP = YES; 427 | ENABLE_NS_ASSERTIONS = NO; 428 | ENABLE_STRICT_OBJC_MSGSEND = YES; 429 | GCC_C_LANGUAGE_STANDARD = gnu99; 430 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 431 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 432 | GCC_WARN_UNDECLARED_SELECTOR = YES; 433 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 434 | GCC_WARN_UNUSED_FUNCTION = YES; 435 | GCC_WARN_UNUSED_VARIABLE = YES; 436 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 437 | MTL_ENABLE_DEBUG_INFO = NO; 438 | SDKROOT = iphoneos; 439 | TARGETED_DEVICE_FAMILY = "1,2"; 440 | VALIDATE_PRODUCT = YES; 441 | }; 442 | name = Release; 443 | }; 444 | 3DCC472C19FFDD54006620A0 /* Debug */ = { 445 | isa = XCBuildConfiguration; 446 | baseConfigurationReference = C304122CA3ACA4DD351ACBB5 /* Pods.debug.xcconfig */; 447 | buildSettings = { 448 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 449 | INFOPLIST_FILE = JBWebViewController/Info.plist; 450 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 451 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | }; 454 | name = Debug; 455 | }; 456 | 3DCC472D19FFDD54006620A0 /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | baseConfigurationReference = ACC8AADF9FCFEA16F95C3932 /* Pods.release.xcconfig */; 459 | buildSettings = { 460 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 461 | INFOPLIST_FILE = JBWebViewController/Info.plist; 462 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 463 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 464 | PRODUCT_NAME = "$(TARGET_NAME)"; 465 | }; 466 | name = Release; 467 | }; 468 | 3DCC472F19FFDD54006620A0 /* Debug */ = { 469 | isa = XCBuildConfiguration; 470 | buildSettings = { 471 | BUNDLE_LOADER = "$(TEST_HOST)"; 472 | FRAMEWORK_SEARCH_PATHS = ( 473 | "$(SDKROOT)/Developer/Library/Frameworks", 474 | "$(inherited)", 475 | ); 476 | GCC_PREPROCESSOR_DEFINITIONS = ( 477 | "DEBUG=1", 478 | "$(inherited)", 479 | ); 480 | INFOPLIST_FILE = JBWebViewControllerTests/Info.plist; 481 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 482 | PRODUCT_NAME = "$(TARGET_NAME)"; 483 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JBWebViewController.app/JBWebViewController"; 484 | }; 485 | name = Debug; 486 | }; 487 | 3DCC473019FFDD54006620A0 /* Release */ = { 488 | isa = XCBuildConfiguration; 489 | buildSettings = { 490 | BUNDLE_LOADER = "$(TEST_HOST)"; 491 | FRAMEWORK_SEARCH_PATHS = ( 492 | "$(SDKROOT)/Developer/Library/Frameworks", 493 | "$(inherited)", 494 | ); 495 | INFOPLIST_FILE = JBWebViewControllerTests/Info.plist; 496 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 497 | PRODUCT_NAME = "$(TARGET_NAME)"; 498 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JBWebViewController.app/JBWebViewController"; 499 | }; 500 | name = Release; 501 | }; 502 | /* End XCBuildConfiguration section */ 503 | 504 | /* Begin XCConfigurationList section */ 505 | 3DCC470319FFDD54006620A0 /* Build configuration list for PBXProject "JBWebViewController" */ = { 506 | isa = XCConfigurationList; 507 | buildConfigurations = ( 508 | 3DCC472919FFDD54006620A0 /* Debug */, 509 | 3DCC472A19FFDD54006620A0 /* Release */, 510 | ); 511 | defaultConfigurationIsVisible = 0; 512 | defaultConfigurationName = Release; 513 | }; 514 | 3DCC472B19FFDD54006620A0 /* Build configuration list for PBXNativeTarget "JBWebViewController" */ = { 515 | isa = XCConfigurationList; 516 | buildConfigurations = ( 517 | 3DCC472C19FFDD54006620A0 /* Debug */, 518 | 3DCC472D19FFDD54006620A0 /* Release */, 519 | ); 520 | defaultConfigurationIsVisible = 0; 521 | defaultConfigurationName = Release; 522 | }; 523 | 3DCC472E19FFDD54006620A0 /* Build configuration list for PBXNativeTarget "JBWebViewControllerTests" */ = { 524 | isa = XCConfigurationList; 525 | buildConfigurations = ( 526 | 3DCC472F19FFDD54006620A0 /* Debug */, 527 | 3DCC473019FFDD54006620A0 /* Release */, 528 | ); 529 | defaultConfigurationIsVisible = 0; 530 | defaultConfigurationName = Release; 531 | }; 532 | /* End XCConfigurationList section */ 533 | }; 534 | rootObject = 3DCC470019FFDD54006620A0 /* Project object */; 535 | } 536 | -------------------------------------------------------------------------------- /Example/JBWebViewController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/JBWebViewController.xcodeproj/project.xcworkspace/xcshareddata/JBWebViewController.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | AC44E470-1356-4786-AD4D-3341E6FB1844 9 | IDESourceControlProjectName 10 | JBWebViewController 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 49B6DBF1F5925E76E83C9707B852BD140A557D24 14 | https://github.com/boserup/JBWebViewController.git 15 | 16 | IDESourceControlProjectPath 17 | Example/JBWebViewController.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 49B6DBF1F5925E76E83C9707B852BD140A557D24 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/boserup/JBWebViewController.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 49B6DBF1F5925E76E83C9707B852BD140A557D24 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 49B6DBF1F5925E76E83C9707B852BD140A557D24 36 | IDESourceControlWCCName 37 | JBWebViewController 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/JBWebViewController.xcodeproj/xcuserdata/jonasboserup.xcuserdatad/xcschemes/JBWebViewController.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /Example/JBWebViewController.xcodeproj/xcuserdata/jonasboserup.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JBWebViewController.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 3DCC470719FFDD54006620A0 16 | 17 | primary 18 | 19 | 20 | 3DCC472019FFDD54006620A0 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/JBWebViewController/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JBWebViewController 4 | // 5 | // Created by Jonas Boserup on 28/10/14. 6 | // Copyright (c) 2014 Jonas Boserup. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Example/JBWebViewController/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JBWebViewController 4 | // 5 | // Created by Jonas Boserup on 28/10/14. 6 | // Copyright (c) 2014 Jonas Boserup. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // 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. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Example/JBWebViewController/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/JBWebViewController/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 36 | 37 | 38 | 39 | 40 | 41 | 50 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /Example/JBWebViewController/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Example/JBWebViewController/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | dk.jonasboserup.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Example/JBWebViewController/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // JBWebViewController 4 | // 5 | // Created by Jonas Boserup on 28/10/14. 6 | // Copyright (c) 2014 Jonas Boserup. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JBWebViewController.h" 11 | 12 | 13 | @interface ViewController : UIViewController 14 | 15 | - (IBAction)showModal:(id)sender; 16 | @property (weak, nonatomic) IBOutlet UITextField *urlField; 17 | 18 | @end 19 | 20 | -------------------------------------------------------------------------------- /Example/JBWebViewController/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // JBWebViewController 4 | // 5 | // Created by Jonas Boserup on 28/10/14. 6 | // Copyright (c) 2014 Jonas Boserup. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | - (IBAction)showModal:(id)sender { 28 | // Creating JBWebViewController and loading URL from text field. 29 | JBWebViewController *controller = [[JBWebViewController alloc] initWithUrl:[NSURL URLWithString:_urlField.text]]; 30 | 31 | // Simple method for showing controller 32 | // [controller show]; 33 | 34 | // Localization (not required, default is 'Loading..') 35 | // [controller setLoadingString:@"Chargement.."]; 36 | 37 | // Method for showing controller with completion block 38 | [controller showControllerWithCompletion:^(JBWebViewController *controller) { 39 | // Completion typedef block 40 | NSLog(@"Controller has arrived."); 41 | }]; 42 | 43 | 44 | } 45 | 46 | -(IBAction)showFrom:(id)sender { 47 | JBWebViewController *controller = [[JBWebViewController alloc] initWithUrl:[NSURL URLWithString:_urlField.text]]; 48 | [controller showFromController:self WithCompletion:^(JBWebViewController *controller) { 49 | NSLog(@"Controller has arrived"); 50 | }]; 51 | } 52 | @end 53 | -------------------------------------------------------------------------------- /Example/JBWebViewController/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JBWebViewController 4 | // 5 | // Created by Jonas Boserup on 28/10/14. 6 | // Copyright (c) 2014 Jonas Boserup. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Example/JBWebViewControllerTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | dk.jonasboserup.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/JBWebViewControllerTests/JBWebViewControllerTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // JBWebViewControllerTests.m 3 | // JBWebViewControllerTests 4 | // 5 | // Created by Jonas Boserup on 28/10/14. 6 | // Copyright (c) 2014 Jonas Boserup. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface JBWebViewControllerTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation JBWebViewControllerTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | 3 | pod 'ARChromeActivity', '~> 1.0' 4 | pod 'ARSafariActivity', '~> 0.0.1' 5 | pod 'NJKWebViewProgress', '~> 0.2' 6 | -------------------------------------------------------------------------------- /Example/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/Example/screenshot.png -------------------------------------------------------------------------------- /JBWebViewController.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint JBWebViewController.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = "JBWebViewController" 11 | s.version = "1.0.8" 12 | s.summary = "A modal view controller for showing websites - inspired by the Facebook app" 13 | s.description = <<-DESC 14 | A drop-in Facebook inspired modal web browser. 15 | 16 | Created to look like the web browser in the current Facebook App on App Store. 17 | DESC 18 | s.homepage = "https://github.com/boserup/JBWebViewController" 19 | s.screenshots = "https://raw.githubusercontent.com/boserup/JBWebViewController/master/Example/screenshot.png" 20 | s.license = "MIT" 21 | s.license = { :type => "MIT", :file => "LICENSE" } 22 | s.author = { "Jonas Boserup" => "jonas@iboserup.dk" } 23 | s.social_media_url = "http://twitter.com/JonasBoserup" 24 | s.platform = :ios, "7.0" 25 | s.source = { :git => "https://github.com/boserup/JBWebViewController.git", :tag => "#{s.version}" } 26 | s.source_files = "JBWebViewController/*.{h,m}" 27 | s.resources = "JBWebViewController/Icons.xcassets" 28 | s.weak_framework = 'WebKit' 29 | s.requires_arc = true 30 | s.dependency 'ARChromeActivity', '1.0.0' 31 | s.dependency 'ARSafariActivity', '0.0.1' 32 | s.dependency 'NJKWebViewProgress', '0.2.3' 33 | end 34 | -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Back.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "back-25.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "back-50.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "back-75.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Back.imageset/back-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Back.imageset/back-25.png -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Back.imageset/back-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Back.imageset/back-50.png -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Back.imageset/back-75.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Back.imageset/back-75.png -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Dismiss.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "dismiss-25.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "dismiss-50.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "dismiss-75.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Dismiss.imageset/dismiss-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Dismiss.imageset/dismiss-25.png -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Dismiss.imageset/dismiss-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Dismiss.imageset/dismiss-50.png -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Dismiss.imageset/dismiss-75.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Dismiss.imageset/dismiss-75.png -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Forward.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "forward-25.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "forward-50.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "forward-75.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Forward.imageset/forward-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Forward.imageset/forward-25.png -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Forward.imageset/forward-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Forward.imageset/forward-50.png -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Forward.imageset/forward-75.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Forward.imageset/forward-75.png -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Share.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "share-25.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "share-50.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x", 16 | "filename" : "share-75.png" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Share.imageset/share-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Share.imageset/share-25.png -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Share.imageset/share-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Share.imageset/share-50.png -------------------------------------------------------------------------------- /JBWebViewController/Icons.xcassets/Share.imageset/share-75.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boserup/JBWebViewController/cb682d0ebda52751ee119fb445b16f4face66a2d/JBWebViewController/Icons.xcassets/Share.imageset/share-75.png -------------------------------------------------------------------------------- /JBWebViewController/JBWebViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // JBWebViewController.h 3 | // JBWebViewController 4 | // 5 | // Created by Jonas Boserup on 28/10/14. 6 | // Copyright (c) 2014 Jonas Boserup. All rights reserved. 7 | // 8 | 9 | // Required Apple libraries 10 | #import 11 | #import 12 | 13 | // Required third-party libraries 14 | #import 15 | #import 16 | #import 17 | #import 18 | 19 | @interface JBWebViewController : UIViewController 20 | 21 | // Typedef for completion block 22 | typedef void (^completion)(JBWebViewController *controller); 23 | 24 | // Loding string 25 | @property (nonatomic, strong) NSString *loadingString; 26 | 27 | // Public variables 28 | @property (nonatomic, strong) UIWebView *webView; 29 | @property (nonatomic, assign) BOOL hideAddressBar; 30 | 31 | // Public header methods 32 | - (id)initWithUrl:(NSURL *)url; 33 | - (void)show; 34 | - (void)showFromController:(UIViewController*)controller; 35 | - (void)dismiss; 36 | - (void)reload; 37 | - (void)share; 38 | - (void)setWebTitle:(NSString *)title; 39 | - (void)setWebSubtitle:(NSString *)subtitle; 40 | - (void)showControllerWithCompletion:(completion)completion; 41 | - (void)showFromController:(UIViewController*)controller WithCompletion:(completion)completion; 42 | - (void)navigateToURL:(NSURL *)url; 43 | - (void)loadRequest:(NSURLRequest *)request; 44 | 45 | // Public return methods 46 | - (NSString *)getWebTitle; 47 | - (NSString *)getWebSubtitle; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /JBWebViewController/JBWebViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // JBWebViewController.m 3 | // JBWebViewController 4 | // 5 | // Created by Jonas Boserup on 28/10/14. 6 | // Copyright (c) 2014 Jonas Boserup. All rights reserved. 7 | // 8 | 9 | #import "JBWebViewController.h" 10 | 11 | @interface JBWebViewController () 12 | 13 | // Private properties 14 | @property (nonatomic, strong) NSURL *url; 15 | @property (nonatomic) BOOL hasExtraButtons; 16 | @property (nonatomic, strong) UIView *titleView; 17 | @property (nonatomic, strong) UILabel *titleLabel; 18 | @property (nonatomic, strong) UILabel *subtitleLabel; 19 | @property (nonatomic, strong) NJKWebViewProgress *progressProxy; 20 | @property (nonatomic, strong) NJKWebViewProgressView *progressView; 21 | @property (nonatomic, strong) UIPopoverController *popoverShareController; 22 | 23 | @end 24 | 25 | @implementation JBWebViewController 26 | 27 | #pragma mark - "Standards" 28 | 29 | - (id)initWithUrl:(NSURL *)url { 30 | if (self = [self init]) { 31 | // Set url and init views 32 | _url = url; 33 | [self setup]; 34 | } 35 | 36 | // Return self 37 | return self; 38 | } 39 | 40 | - (void)viewDidLoad { 41 | // Standard super class stuff 42 | [super viewDidLoad]; 43 | } 44 | 45 | - (void)didReceiveMemoryWarning { 46 | // Standard super class stuff 47 | [super didReceiveMemoryWarning]; 48 | } 49 | 50 | - (void)viewWillAppear:(BOOL)animated 51 | { 52 | // Standard super class stuff 53 | [super viewWillAppear:animated]; 54 | [_titleLabel setTextColor:self.navigationController.navigationBar.tintColor]; 55 | [_subtitleLabel setTextColor:self.navigationController.navigationBar.tintColor]; 56 | 57 | // Add NJKWebViewProgressView to UINavigationBar 58 | _progressView = [[NJKWebViewProgressView alloc] initWithFrame:CGRectMake(0, self.navigationController.navigationBar.frame.size.height - 2, self.navigationController.navigationBar.frame.size.width, 2)]; 59 | [self.navigationController.navigationBar addSubview:_progressView]; 60 | } 61 | 62 | - (void)viewWillDisappear:(BOOL)animated 63 | { 64 | // Standard super class stuff 65 | [super viewWillDisappear:animated]; 66 | 67 | // Remove views 68 | [_progressView removeFromSuperview]; 69 | [_titleView removeFromSuperview]; 70 | } 71 | 72 | - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { 73 | // Will adjust views in UINavigationBar upon changed interface orientation 74 | [self adjustNavigationbar]; 75 | } 76 | 77 | - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 78 | { 79 | // Update progressBar location 80 | CGFloat progressBarHeight = 2.f; 81 | CGRect navigaitonBarBounds = self.navigationController.navigationBar.bounds; 82 | CGRect barFrame = CGRectMake(0, navigaitonBarBounds.size.height - progressBarHeight, navigaitonBarBounds.size.width, progressBarHeight); 83 | [_progressView setFrame:barFrame]; 84 | } 85 | 86 | #pragma mark - "Setup" 87 | 88 | - (void)setup { 89 | // Default value 90 | _hasExtraButtons = NO; 91 | 92 | // Allows navigationbar to overlap webview 93 | self.automaticallyAdjustsScrollViewInsets = YES; 94 | self.edgesForExtendedLayout = UIRectEdgeTop; 95 | 96 | // Create title & subtitle labels 97 | _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; 98 | [_titleLabel setBackgroundColor:[UIColor clearColor]]; 99 | [_titleLabel setTextColor:[UIColor blackColor]]; 100 | [_titleLabel setFont:[UIFont boldSystemFontOfSize:14]]; 101 | [_titleLabel setTextAlignment:NSTextAlignmentNatural]; 102 | [_titleLabel setText:_loadingString]; 103 | [_titleLabel sizeToFit]; 104 | 105 | _subtitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 14, 0, 0)]; 106 | [_subtitleLabel setBackgroundColor:[UIColor clearColor]]; 107 | [_subtitleLabel setTextColor:[UIColor blackColor]]; 108 | [_subtitleLabel setFont:[UIFont systemFontOfSize:12]]; 109 | [_subtitleLabel setTextAlignment:NSTextAlignmentLeft]; 110 | [_subtitleLabel setText:[self getDomainFromString:[NSString stringWithFormat:@"%@", _url]]]; 111 | [_subtitleLabel sizeToFit]; 112 | 113 | // Correct frame sizes after sizeToFit 114 | [self adjustNavigationbar]; 115 | 116 | // Add new titleview with labels 117 | _titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 30)]; 118 | [_titleView setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; 119 | 120 | [_titleView addSubview:_titleLabel]; 121 | [_titleView addSubview:_subtitleLabel]; 122 | 123 | self.navigationItem.titleView = _titleView; 124 | 125 | // Inset right buttons 126 | UIBarButtonItem *shareButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Share"] style:UIBarButtonItemStylePlain target:self action:@selector(share)]; 127 | UIBarButtonItem *dismissButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Dismiss"] style:UIBarButtonItemStylePlain target:self action:@selector(dismiss)]; 128 | [self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:dismissButton, shareButton, nil]]; 129 | 130 | // Add a webview 131 | _webView = [[UIWebView alloc] initWithFrame:self.view.frame]; 132 | [_webView setAutoresizingMask:UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth]; 133 | 134 | [self.view addSubview:_webView]; 135 | 136 | // Configureing NJKWebViewProgress 137 | _progressProxy = [[NJKWebViewProgress alloc] init]; 138 | _webView.delegate = _progressProxy; 139 | _progressProxy.webViewProxyDelegate = self; 140 | _progressProxy.progressDelegate = self; 141 | 142 | CGFloat progressBarHeight = 2.f; 143 | CGRect navigaitonBarBounds = self.navigationController.navigationBar.bounds; 144 | CGRect barFrame = CGRectMake(0, navigaitonBarBounds.size.height - progressBarHeight, navigaitonBarBounds.size.width, progressBarHeight); 145 | _progressView = [[NJKWebViewProgressView alloc] initWithFrame:barFrame]; 146 | _progressView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; 147 | 148 | // Navigating to URL 149 | [self navigateToURL:_url]; 150 | } 151 | 152 | #pragma mark - "Showing controller" 153 | 154 | -(void)setHideAddressBar:(BOOL)hideAdressBar { 155 | _hideAddressBar = hideAdressBar; 156 | 157 | self.subtitleLabel.hidden = hideAdressBar; 158 | [self adjustNavigationbar]; 159 | } 160 | 161 | - (void)show { 162 | // Showing controller with no completion void 163 | [self showControllerWithCompletion:nil]; 164 | } 165 | 166 | - (void)showFromController:(UIViewController*)controller 167 | { 168 | [self showFromController:controller WithCompletion:nil]; 169 | 170 | } 171 | 172 | - (void)showControllerWithCompletion:(completion)completion { 173 | // Creates navigation controller, and presents it 174 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:self]; 175 | 176 | // Using modalViewController completion void 177 | [[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController:navigationController animated:YES completion:^{ 178 | // Send completion callback 179 | if (completion) { 180 | completion(self); 181 | } 182 | }]; 183 | } 184 | - (void)showFromController:(UIViewController*)controller WithCompletion:(completion)completion 185 | { 186 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:self]; 187 | [controller presentViewController:navigationController animated:YES completion:^{ 188 | if (completion) { 189 | completion(self); 190 | } 191 | }]; 192 | } 193 | 194 | #pragma mark - "Navigation" 195 | 196 | - (void)navigateToURL:(NSURL *)url { 197 | // Tell UIWebView to load url 198 | [_webView loadRequest:[NSURLRequest requestWithURL:url]]; 199 | } 200 | 201 | - (void)reload { 202 | // Tell UIWebView to reload 203 | [_webView reload]; 204 | } 205 | 206 | - (void)navigateBack { 207 | // Tell UIWebView to go back 208 | [_webView goBack]; 209 | } 210 | 211 | - (void)navigateForward { 212 | // Tell UIWebView to go forward 213 | [_webView goForward]; 214 | } 215 | 216 | - (void)loadRequest:(NSURLRequest *)request { 217 | // Tell UIWebView to load request 218 | [_webView loadRequest:request]; 219 | } 220 | 221 | #pragma mark - "Right buttons" 222 | 223 | - (void)share { 224 | // Create instances of third-party share actions 225 | ARSafariActivity *safariActivity = [[ARSafariActivity alloc] init]; 226 | ARChromeActivity *chromeActivity = [[ARChromeActivity alloc] init]; 227 | 228 | // Create share controller from our url 229 | UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:@[self.webView.request.URL] applicationActivities:@[safariActivity, chromeActivity]]; 230 | 231 | // If device is iPad 232 | if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { 233 | // Dismiss popover if present 234 | if(_popoverShareController) { 235 | [_popoverShareController dismissPopoverAnimated:YES]; 236 | } 237 | 238 | // Insert share controller in popover and present it 239 | _popoverShareController = [[UIPopoverController alloc] initWithContentViewController:controller]; 240 | [_popoverShareController presentPopoverFromBarButtonItem:self.navigationItem.rightBarButtonItems[1] permittedArrowDirections: UIPopoverArrowDirectionAny animated:YES]; 241 | } else { 242 | // Present share sheet (on iPhone) 243 | [self presentViewController:controller animated:YES completion:nil]; 244 | } 245 | } 246 | 247 | - (void)dismiss { 248 | [self dismissViewControllerAnimated:YES completion:^{ 249 | // Code 250 | }]; 251 | } 252 | 253 | #pragma mark - "Navigationbar" 254 | 255 | - (void)adjustNavigationbar { 256 | // Width of buttons in UINavigationBar 257 | float buttonsWidth; 258 | 259 | if(_hasExtraButtons) { 260 | buttonsWidth = 220; 261 | } else { 262 | buttonsWidth = 110; 263 | } 264 | 265 | // Setting frames on title & subtitle labels 266 | if (_hideAddressBar) { 267 | [_titleLabel setFrame:CGRectMake(_titleLabel.frame.origin.x, _titleView.frame.size.height/2-_titleLabel.frame.size.height/2, MIN(_titleLabel.frame.size.width, self.view.frame.size.width - buttonsWidth), _titleLabel.frame.size.height)]; 268 | } else { 269 | [_titleLabel setFrame:CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.origin.y, MIN(_titleLabel.frame.size.width, self.view.frame.size.width - buttonsWidth), _titleLabel.frame.size.height)]; 270 | } 271 | [_subtitleLabel setFrame:CGRectMake(_subtitleLabel.frame.origin.x, _subtitleLabel.frame.origin.y, MIN(_subtitleLabel.frame.size.width, self.view.frame.size.width - buttonsWidth), _subtitleLabel.frame.size.height)]; 272 | } 273 | 274 | - (void)addNavigationButtonsButtons { 275 | // Creating buttons 276 | UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Back"] style:UIBarButtonItemStylePlain target:self action:@selector(navigateBack)]; 277 | UIBarButtonItem *forwardButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Forward"] style:UIBarButtonItemStylePlain target:self action:@selector(navigateForward)]; 278 | 279 | // Adding buttons to NavigationBar 280 | [self.navigationItem setLeftBarButtonItems:[NSArray arrayWithObjects:backButton, forwardButton, nil]]; 281 | 282 | // Remember that we have extra buttons now 283 | _hasExtraButtons = YES; 284 | 285 | // And finally adjust NavigationBar 286 | [self adjustNavigationbar]; 287 | } 288 | 289 | - (void)updateNavigationButtons { 290 | // If no left buttons are present and webView can go back, then add buttons 291 | if(!self.navigationItem.leftBarButtonItems.count && [_webView canGoBack]) { 292 | [self addNavigationButtonsButtons]; 293 | } 294 | 295 | // If we can go back, enable back button 296 | if([_webView canGoBack]) { 297 | ((UIBarButtonItem *)self.navigationItem.leftBarButtonItems[0]).enabled = YES; 298 | } else { 299 | ((UIBarButtonItem *)self.navigationItem.leftBarButtonItems[0]).enabled = NO; 300 | } 301 | 302 | // If we can go forward, enable forward button 303 | if([_webView canGoForward]) { 304 | ((UIBarButtonItem *)self.navigationItem.leftBarButtonItems[1]).enabled = YES; 305 | } else { 306 | ((UIBarButtonItem *)self.navigationItem.leftBarButtonItems[1]).enabled = NO; 307 | } 308 | } 309 | 310 | #pragma mark - "Titles & subtitles" 311 | 312 | - (void)setWebTitle:(NSString *)title { 313 | // Set title & update frame 314 | [_titleLabel setText:title]; 315 | [_titleLabel sizeToFit]; 316 | [self adjustNavigationbar]; 317 | } 318 | 319 | - (void)setWebSubtitle:(NSString *)subtitle { 320 | // Set subtitle & update frame 321 | [_subtitleLabel setText:subtitle]; 322 | [_subtitleLabel sizeToFit]; 323 | [self adjustNavigationbar]; 324 | } 325 | 326 | // Get title 327 | - (NSString *)getWebTitle { 328 | return _titleLabel.text; 329 | } 330 | 331 | // Get subtitle 332 | - (NSString *)getWebSubtitle { 333 | return _subtitleLabel.text; 334 | } 335 | 336 | #pragma mark - "Helpers" 337 | 338 | - (NSString *)getDomainFromString:(NSString*)string 339 | { 340 | // Split url into components 341 | NSArray *components = [string componentsSeparatedByString:@"/"]; 342 | for (NSString *match in components) { 343 | // If component has range of ".", return match 344 | if ([match rangeOfString:@"."].location != NSNotFound){ 345 | return match; 346 | } 347 | } 348 | return nil; 349 | } 350 | 351 | #pragma mark - UIWebViewDelegate 352 | 353 | - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType 354 | { 355 | return true; 356 | } 357 | 358 | - (void)webViewDidFinishLoad:(UIWebView *)webView 359 | { 360 | // Update title when page is loaded 361 | NSString *title = [webView stringByEvaluatingJavaScriptFromString: @"document.title"]; 362 | NSString *subtitle = [webView stringByEvaluatingJavaScriptFromString:@"document.domain"]; 363 | 364 | [self setWebTitle:title]; 365 | [self setWebSubtitle:subtitle]; 366 | 367 | [self updateNavigationButtons]; 368 | } 369 | 370 | - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error 371 | { 372 | // Log error 373 | NSLog(@"%@", [error localizedDescription]); 374 | } 375 | 376 | #pragma mark - NJKWebViewProgressDelegate 377 | -(void)webViewProgress:(NJKWebViewProgress *)webViewProgress updateProgress:(float)progress 378 | { 379 | // Update NJKWebViewProgressView 380 | [_progressView setProgress:progress animated:YES]; 381 | 382 | // Update title 383 | NSString *title = [_webView stringByEvaluatingJavaScriptFromString: @"document.title"]; 384 | 385 | // If no title is found, set it to "Loading.." 386 | if(title.length == 0) { 387 | [self setWebTitle:_loadingString]; 388 | } else { 389 | [self setWebTitle:title]; 390 | } 391 | } 392 | 393 | @end 394 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Jonas Boserup 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | JBWebViewController 2 | =================== 3 | 4 | A drop-in Facebook inspired modal web browser. 5 | 6 | JBWebViewController Screenshot 7 | 8 | ## Video Demo 9 | JBWebViewController Video Demo 12 | 13 | ## Installation 14 | 15 | ### CocoaPods 16 | The recommended approach for installing JBWebViewController is through the package manager [CocoaPods](http://cocoapods.org/), which is widely used by iOS & Mac developers. 17 | 18 | Simply add the following line to your Podfile: 19 | ```ruby 20 | pod "JBWebViewController" 21 | ``` 22 | 23 | ### Manual Install 24 | Drag the JBWebViewController folder into your Xcode project, you may need to check the box "Copy items into destination group's folder (if needed)". 25 | 26 | JBWebViewController needs the following third-party libraries: 27 | * [ARChromeActivity](https://github.com/alextrob/ARChromeActivity) 28 | * [ARSafariActivity](https://github.com/alexruperez/ARSafariActivity) 29 | * [NJKWebViewProgress](https://github.com/ninjinkun/NJKWebViewProgress) 30 | 31 | ## Apps using JBWebViewController 32 | - [Copenhagen Fashion Week®](http://itunes.apple.com/app/id901148180?mt=8) 33 | - [Ookull](http://itunes.apple.com/app/id934603488?mt=8) 34 | 35 | Feel free to add your app to the list. 36 | 37 | ## How to use 38 | JBWebViewController is ment to be shown modally, which is recommended to be down with it's built in show functionality. Whilst not being recommended, it is however possible to present JBWebViewController outside a modal view controller. JBWebViewController should always be connected to a UINavigationController. 39 | 40 | #### Presenting JBWebViewController 41 | ```objectivec 42 | JBWebViewController *controller = [[JBWebViewController alloc] initWithUrl:[NSURL URLWithString:@"http://www.apple.com/iphone/"]]; 43 | 44 | [controller show]; 45 | ``` 46 | 47 | #### Presenting JBWebViewController with block 48 | ```objectivec 49 | JBWebViewController *controller = [[JBWebViewController alloc] initWithUrl:[NSURL URLWithString:@"http://www.apple.com/iphone/"]]; 50 | 51 | [controller showControllerWithCompletion:^(JBWebViewController *controller) { 52 | NSLog(@"Controller has arrived."); 53 | }]; 54 | ``` 55 | 56 | #### Localization 57 | ```objectivec 58 | [controller setLoadingString:@"Chargement.."]; 59 | ``` 60 | 61 | #### Navigate to URL 62 | ```objectivec 63 | [controller navigateToURL:[NSURL URLWithString:@"http://www.apple.com/ios/"]]; 64 | ``` 65 | 66 | #### Load custom NSURLRequest 67 | ```objectivec 68 | NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://developer.apple.com/"]]; 69 | [controller loadRequest:request]; 70 | ``` 71 | 72 | #### Reload current page 73 | ```objectivec 74 | [controller reload]; 75 | ``` 76 | 77 | #### Manually setting controller title 78 | ```objectivec 79 | [controller setWebTitle:@"The quick brown fox"]; 80 | ``` 81 | 82 | #### Getting controller title 83 | ```objectivec 84 | NSString *controllerTitle = [controller getWebTitle]; 85 | ``` 86 | 87 | #### Manually setting controller subtitle 88 | ```objectivec 89 | [controller setWebSubtitle:@"foo bar"]; 90 | ``` 91 | 92 | #### Getting controller subtitle 93 | ```objectivec 94 | NSString *controllerSubtitle = [controller getWebSubtitle]; 95 | ``` 96 | 97 | #### Hide URL 98 | ```objectivec 99 | controller.hideAddressBar = YES; 100 | ``` 101 | 102 | #### Access UIWebView 103 | The UIWebView used in the controller is now public. 104 | ```objectivec 105 | UIWebView *webView; 106 | ``` 107 | 108 | ## Icons 109 | Free icons by [Icons8](http://icons8.com/) under [Creative Commons Attribution-NoDerivs 3.0 Unported](https://creativecommons.org/licenses/by-nd/3.0/). 110 | 111 | ## Contact 112 | 113 | Mention me on Twitter ([@JonasBoserup](https://twitter.com/JonasBoserup)) or email me ([Profile](https://github.com/boserup)). 114 | 115 | ## License 116 | 117 | JBWebViewController is available under the MIT license. See the LICENSE file for more info. 118 | --------------------------------------------------------------------------------