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
Ability to change the doneButton tintColor independently of the other…
… bar button items.
  • Loading branch information
parkej60 committed Nov 12, 2014
commit 13c646bd48c1e9e10d2d6d271336f8de153b77d9
1 change: 1 addition & 0 deletions SVWebViewController/SVModalWebViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
- (instancetype)initWithURLRequest:(NSURLRequest *)request;

@property (nonatomic, strong) UIColor *barsTintColor;
@property (nonatomic, strong) UIColor *doneButtonTintColor;

@end
8 changes: 5 additions & 3 deletions SVWebViewController/SVModalWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@interface SVModalWebViewController ()

@property (nonatomic, strong) SVWebViewController *webViewController;
@property (nonatomic, strong) UIBarButtonItem *doneButton;

@end

Expand All @@ -38,14 +39,14 @@ - (instancetype)initWithURL:(NSURL *)URL {
- (instancetype)initWithURLRequest:(NSURLRequest *)request {
self.webViewController = [[SVWebViewController alloc] initWithURLRequest:request];
if (self = [super initWithRootViewController:self.webViewController]) {
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
self.doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self.webViewController
action:@selector(doneButtonTapped:)];

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
self.webViewController.navigationItem.leftBarButtonItem = doneButton;
self.webViewController.navigationItem.leftBarButtonItem = self.doneButton;
else
self.webViewController.navigationItem.rightBarButtonItem = doneButton;
self.webViewController.navigationItem.rightBarButtonItem = self.doneButton;
}
return self;
}
Expand All @@ -55,6 +56,7 @@ - (void)viewWillAppear:(BOOL)animated {

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

@end