Skip to content

Commit

Permalink
Added proper license to each of the code files
Browse files Browse the repository at this point in the history
  • Loading branch information
nbuggia committed Oct 29, 2011
1 parent 912c974 commit f51bf4d
Show file tree
Hide file tree
Showing 13 changed files with 5,697 additions and 3,332 deletions.
45 changes: 45 additions & 0 deletions Browser Demo/BrowserSampleViewController.h
@@ -0,0 +1,45 @@
//
// BrowserSampleViewController.h
//
// This software is licensed under the MIT Software License
//
// Copyright (c) 2011 Nathan Buggia
// http://nathanbuggia.com/posts/browser-view-controller/
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of
// the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// Artwork generously contributed by Joseph Wain of http://glyphish.com (buy his Pro pack of icons!)
//

#import <UIKit/UIKit.h>
#import "BrowserViewController.h"

#define DEMO_URL @"http://nytimes.com"

@interface BrowserSampleViewController : UIViewController
<UIWebViewDelegate>
{
IBOutlet UIWebView *webView;
IBOutlet UIButton *button;
IBOutlet UITextView *textView;
}

@property (nonatomic, retain) UIWebView *webView;
@property (nonatomic, retain) UIButton *button;
@property (nonatomic, retain) UITextView *textView;

- (IBAction)openLinkInBrowser:(id)sender;

@end
103 changes: 103 additions & 0 deletions Browser Demo/BrowserSampleViewController.m
@@ -0,0 +1,103 @@
//
// BrowserSampleViewController.m
//
// This software is licensed under the MIT Software License
//
// Copyright (c) 2011 Nathan Buggia
// http://nathanbuggia.com/posts/browser-view-controller/
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of
// the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// Artwork generously contributed by Joseph Wain of http://glyphish.com (buy his Pro pack of icons!)
//

#import "BrowserSampleViewController.h"

@implementation BrowserSampleViewController

@synthesize webView;
@synthesize button;
@synthesize textView;

- (void)openLinkInBrowser:(id)sender
{
NSURL *url = [NSURL URLWithString:DEMO_URL];
BrowserViewController *bvc = [[BrowserViewController alloc] initWithUrls:url];
[self.navigationController pushViewController:bvc animated:YES];
[bvc release];
}

-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
if ( inType == UIWebViewNavigationTypeLinkClicked ) {
[[UIApplication sharedApplication] openURL:[inRequest URL]];
return NO;
}

return YES;
}

- (void)viewDidLoad
{
[super viewDidLoad];
NSString* theHtml = [NSString stringWithFormat:@"<html><body><a href=\"%@\">%@</a></body></html>", DEMO_URL, DEMO_URL];
[webView loadHTMLString:theHtml baseURL:nil];

[button setTitle:DEMO_URL forState:UIControlStateNormal];

[textView setText:DEMO_URL];
}

- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}

- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Relinquish ownership any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload
{
[super viewDidUnload];

// Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
// For example: self.myOutlet = nil;
}

- (void)dealloc
{
[super dealloc];
}

@end

0 comments on commit f51bf4d

Please sign in to comment.