Skip to content
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "SVWebViewController/vendors/OpenInChromeController"]
path = SVWebViewController/vendors/OpenInChromeController
url=https://github.com/adonoho/OpenInChrome.git
9 changes: 4 additions & 5 deletions SVWebViewController/SVModalWebViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
//
// https://github.com/samvermette/SVWebViewController

#import <UIKit/UIKit.h>
@import UIKit;

@class SVWebViewController;

@interface SVModalWebViewController : UINavigationController
@interface SVModalWebViewController : UINavigationController <UIToolbarDelegate>

- (id)initWithAddress:(NSString*)urlString;
- (id)initWithURL:(NSURL *)URL;

@property (nonatomic, strong) UIColor *barsTintColor;
@property (nonatomic) UIColor *barTintColor;
@property (getter = isBarAttached, nonatomic) BOOL barAttached;

@end
25 changes: 21 additions & 4 deletions SVWebViewController/SVModalWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ - (id)initWithURL:(NSURL *)URL {
if (self = [super initWithRootViewController:self.webViewController]) {
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self.webViewController
action:@selector(doneButtonClicked:)];
action:kDoneButtonClicked];

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
self.webViewController.navigationItem.leftBarButtonItem = doneButton;
Expand All @@ -40,11 +40,28 @@ - (id)initWithURL:(NSURL *)URL {
return self;
}

- (void)viewWillAppear:(BOOL)animated {
- (void) viewWillAppear: (BOOL) animated {

[super viewWillAppear:NO];

self.webViewController.title = self.title;
self.navigationBar.tintColor = self.barsTintColor;
}

if (self.barTintColor) {

self.navigationBar.barTintColor = self.barTintColor;
}

} // -viewWillAppear:


#pragma mark - UIToolbarDelegate methods.


- (UIBarPosition) positionForBar: (id<UIBarPositioning>) bar {

return self.isBarAttached ? UIBarPositionTopAttached : UIBarPositionTop;

} // -positionForBar:


@end
24 changes: 23 additions & 1 deletion SVWebViewController/SVWebViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,33 @@
//
// https://github.com/samvermette/SVWebViewController

#import "SVModalWebViewController.h"
@import UIKit;

@protocol SVWebViewControllerDelegate;
@protocol SVWebViewPresenter <UIWebViewDelegate, SVWebViewControllerDelegate>
@end

@interface SVWebViewController : UIViewController

@property (nonatomic) UIWebView *webView;
@property (weak, nonatomic) id<SVWebViewPresenter> delegate;

- (id)initWithAddress:(NSString*)urlString;
- (id)initWithURL:(NSURL*)URL;

#define kDoneButtonClicked (@selector(doneButtonClicked:))
- (void) doneButtonClicked: (id) sender;

@end

@protocol SVWebViewControllerDelegate <NSObject>

@optional

- (void) webViewControllerWillAppear: (SVWebViewController *) wvc;
- (void) webViewControllerDidAppear: (SVWebViewController *) wvc;

- (void) webViewControllerWillDisappear: (SVWebViewController *) wvc;
- (void) webViewControllerDidDisappear: (SVWebViewController *) wvc;

@end
Loading