Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podspec & iOS 7 support #33

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions TSMiniWebBrowser.podspec
Original file line number Diff line number Diff line change
@@ -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' => '[email protected]' }
s.source = { :git => 'https://github.com/tonisalae/TSMiniWebBrowser.git', :branch => "master" }
s.source_files = 'TSMiniWebBrowser/*.{h,m}'
s.framework = 'QuartzCore'
s.requires_arc = true
s.resources = 'TSMiniWebBrowser/images/*.png', 'TSMiniWebBrowser/*.xib'
end
11 changes: 8 additions & 3 deletions TSMiniWebBrowser/TSMiniWebBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,17 @@ -(void) initWebView {
if (mode == TSMiniWebBrowserModeModal) {
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, kToolBarHeight, viewSize.width, viewSize.height-kToolBarHeight*2)];
} else if(mode == TSMiniWebBrowserModeNavigation) {
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, viewSize.width, viewSize.height-kToolBarHeight)];
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, viewSize.width, viewSize.height)];
bool translucentNavBar = self.navigationController.navigationBar.isTranslucent;
[[webView scrollView] setContentInset:UIEdgeInsetsMake((translucentNavBar ? 64 : 0), 0, 44, 0)];
[[webView scrollView] setScrollIndicatorInsets:UIEdgeInsetsMake((translucentNavBar ? 64 : 0), 0, 44, 0)];
} else if(mode == TSMiniWebBrowserModeTabBar) {
self.view.backgroundColor = [UIColor redColor];
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, kToolBarHeight-1, viewSize.width, viewSize.height-kToolBarHeight+1)];
}
webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:webView];
[self.view bringSubviewToFront:toolBar];

webView.scalesPageToFit = YES;

Expand Down Expand Up @@ -215,6 +219,7 @@ - (id)initWithUrl:(NSURL*)url {
forcedTitleBarText = nil;
barStyle = UIBarStyleDefault;
barTintColor = nil;
self.automaticallyAdjustsScrollViewInsets = NO;
}

return self;
Expand Down Expand Up @@ -458,8 +463,8 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
else
{
if ([[request.URL absoluteString] hasPrefix:@"http://www.youtube.com/v/"] ||
[[request.URL absoluteString] hasPrefix:@"http://itunes.apple.com/"] ||
[[request.URL absoluteString] hasPrefix:@"http://phobos.apple.com/"]) {
[[request.URL host] isEqualToString:@"itunes.apple.com"] ||
[[request.URL host] isEqualToString:@"phobos.apple.com"]) {
[[UIApplication sharedApplication] openURL:request.URL];
return NO;
}
Expand Down