From 06b7cc5ba3b4ba9340afdaa46706fdfa8d1da350 Mon Sep 17 00:00:00 2001 From: Simon Strandgaard Date: Sun, 30 Jun 2013 02:14:47 +0200 Subject: [PATCH 1/4] Eliminated warning on iOS7 that dismissModalViewControllerAnimated: is deprecated. --- TSMiniWebBrowser/TSMiniWebBrowser.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TSMiniWebBrowser/TSMiniWebBrowser.m b/TSMiniWebBrowser/TSMiniWebBrowser.m index 0c8a9f5..9357ff5 100644 --- a/TSMiniWebBrowser/TSMiniWebBrowser.m +++ b/TSMiniWebBrowser/TSMiniWebBrowser.m @@ -80,7 +80,11 @@ -(void) dismissController { if ( webView.loading ) { [webView stopLoading]; } +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_5_0 + [self dismissViewControllerAnimated:YES completion:nil]; +#else [self dismissModalViewControllerAnimated:YES]; +#endif // Notify the delegate if (self.delegate != NULL && [self.delegate respondsToSelector:@selector(tsMiniWebBrowserDidDismiss)]) { From 10d0459fc0d64eba00f3d2e411519f0081c1ff75 Mon Sep 17 00:00:00 2001 From: Simon Strandgaard Date: Sun, 30 Jun 2013 02:40:09 +0200 Subject: [PATCH 2/4] On iOS7 the web content can be seen through the navigationbar+statusbar, so it is necessary to set contentInset. --- TSMiniWebBrowser/TSMiniWebBrowser.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TSMiniWebBrowser/TSMiniWebBrowser.m b/TSMiniWebBrowser/TSMiniWebBrowser.m index 9357ff5..04e3639 100644 --- a/TSMiniWebBrowser/TSMiniWebBrowser.m +++ b/TSMiniWebBrowser/TSMiniWebBrowser.m @@ -195,6 +195,10 @@ -(void) initWebView { webView.scalesPageToFit = YES; webView.delegate = self; + +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0 + webView.scrollView.contentInset = UIEdgeInsetsMake(64, 0, 0, 0); +#endif // Load the URL in the webView NSURLRequest *requestObj = [NSURLRequest requestWithURL:urlToLoad]; From 4b7e7c0b57278cf5b23fbdceffbb097e8da90919 Mon Sep 17 00:00:00 2001 From: Simon Strandgaard Date: Sun, 30 Jun 2013 02:46:34 +0200 Subject: [PATCH 3/4] Added podspec --- TSMiniWebBrowser.podspec | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 TSMiniWebBrowser.podspec diff --git a/TSMiniWebBrowser.podspec b/TSMiniWebBrowser.podspec new file mode 100644 index 0000000..b1979b5 --- /dev/null +++ b/TSMiniWebBrowser.podspec @@ -0,0 +1,14 @@ +Pod::Spec.new do |s| + s.name = 'TSMiniWebBrowser' + s.version = '1.0.1' + s.platform = :ios + s.license = 'MIT' + s.summary = 'An in-app web browser control for iOS apps.' + s.homepage = 'https://github.com/tonisalae/TSMiniWebBrowser' + s.author = { 'Toni Sala' => 'tonisalae@gmail.com' } + s.source = { :git => 'https://github.com/neoneye/TSMiniWebBrowser.git', :tag => 'version_1.0.1' } + s.source_files = 'TSMiniWebBrowser/*.{h,m}' + s.framework = 'QuartzCore' + s.requires_arc = true + s.resources = 'TSMiniWebBrowser/TSMiniWebBrowser.bundle', 'TSMiniWebBrowser/localizations', 'TSMiniWebBrowser/*.xib' +end \ No newline at end of file From cb0c265eb7f4008ab3ba9b96f5f999683e00f604 Mon Sep 17 00:00:00 2001 From: Simon Strandgaard Date: Sun, 30 Jun 2013 03:25:54 +0200 Subject: [PATCH 4/4] Changed compile time check to a runtime check, so that the contentInset is only set on iOS7+. --- TSMiniWebBrowser/TSMiniWebBrowser.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/TSMiniWebBrowser/TSMiniWebBrowser.m b/TSMiniWebBrowser/TSMiniWebBrowser.m index 04e3639..f09a4f8 100644 --- a/TSMiniWebBrowser/TSMiniWebBrowser.m +++ b/TSMiniWebBrowser/TSMiniWebBrowser.m @@ -196,9 +196,10 @@ -(void) initWebView { webView.delegate = self; -#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0 - webView.scrollView.contentInset = UIEdgeInsetsMake(64, 0, 0, 0); -#endif + if (([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending)) { + // On iOS7 the webview can be seen through the navigationbar + webView.scrollView.contentInset = UIEdgeInsetsMake(64, 0, 0, 0); + } // Load the URL in the webView NSURLRequest *requestObj = [NSURLRequest requestWithURL:urlToLoad];